Home » SQL & PL/SQL » SQL & PL/SQL » using select statement
using select statement [message #327830] Wed, 18 June 2008 02:42 Go to next message
krithi86
Messages: 19
Registered: June 2008
Location: India
Junior Member
my table description is as follows

EMP_NAME VARCHAR2(50 BYTE)
EMP_ID NUMBER
DEPT_NO NUMBER
PERIOD_NAME VARCHAR2(30 BYTE)
HRSFORWEEK1 NUMBER
HRSFORWEEK2 NUMBER
HRSFORWEEK3 NUMBER
HRSFORWEEK4 NUMBER
HRSFORWEEK5 NUMBER

i should get the result like

deptno empname empid period week1hrs week2hrs week3hrs week4thurshrs week5hrs MONTHLY_HRS
------ -------------------- ----- -------- -------- -------- -------- ------------- -------- -----------
10 Jothika 12 JAN-08 40 40 40 40 40 200
Simran 14 JAN-08 30 40 40 40 40 190
Kajol 15 JAN-08 30 20 40 40 40 170
****** -----------
deptot 560

here 560 is the MONTHLY_HRS's total. how to use select statement to achieve this?
Re: using select statement [message #327832 is a reply to message #327830] Wed, 18 June 2008 02:44 Go to previous message
Michel Cadot
Messages: 68711
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
See BREAK and COMPUTE command in SQL*PlusŪ User's Guide and Reference

Before next post please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel
Previous Topic: Insert Row Data as columns into Another Table
Next Topic: getting table values as a hierarchy (merged)
Goto Forum:
  


Current Time: Sat Nov 09 13:21:19 CST 2024