Re: Select query for sum of hours

From: Christine <karistom_at_hotmail.com>
Date: 10 Aug 2004 19:03:46 -0700
Message-ID: <693b7163.0408101803.64174114_at_posting.google.com>


> 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'.

  1. add together ... SELECT SUM(hours) FROM WW_REC_1 where trans_date between last_DAY(ADD_MONTHS(SYSDATE, -2))+1 and LAST_DAY(ADD_MONTHS(SYSDATE,-1)) where note='ACT' OR note='CHG'
  2. also add together ... SELECT SUM(hours) FROM WW_REC_1 where trans_date between last_DAY(ADD_MONTHS(SYSDATE, -2))+1 and LAST_DAY(ADD_MONTHS(SYSDATE,-1)) where note='EXT' OR note='INT'
Received on Wed Aug 11 2004 - 04:03:46 CEST

Original text of this message