Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.oracle -> Select query for sum of hours

Select query for sum of hours

From: George <georgina.wren_at_eu.watsonwyatt.com>
Date: 10 Aug 2004 07:19:55 -0700
Message-ID: <d45230d0.0408100619.1f752793@posting.google.com>


Hi,

The sql query below returns data in the 'note' field from a table called ww_rec_1 from the previous month and displays the sum of hours for each category.

SELECT note,SUM(hours)FROM WW_REC_1
where trans_date between
last_DAY(ADD_MONTHS(SYSDATE, -2))+1
and LAST_DAY(ADD_MONTHS(SYSDATE,-1))
GROUP BY NOTE This is the returned data:

"NOTE", "SUM(HOURS)"

"ACT", -330864.75
"CHG", -165.25
"EXT", 331108.5
"INT", 45
I need to add together the sum of hours for specified data in the note field. So in this case I want to add together the sum of hours for 'ACT' and 'CHG'. I also need to add together the sum of hours for 'EXT' and 'INT'.

Can anyone help me out with this?

Thanks in advance

George Received on Tue Aug 10 2004 - 09:19:55 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US