How about :

Select to_char(actual_date, 'YYYY-Q'), sum (value) from daily_data
Where sensor_id=?
Group by to_char(actual_date, 'YYYY-Q')

Couldn't you have the to_char format mask as a bind variable ?

Steve

-----Original Message-----
From: Fong, Anna [mailto:anna@;water.ca.gov] 
Sent: Friday, 15 November 2002 7:01 AM
To: [EMAIL PROTECTED]
Subject: OT: Oracle Group By statement


Can anyone point me to the answer?

I want to use an arbitrary group in the group by statement.  I can group
by year but want to change the calendar year to another unit of measure
such as quarter.

This works:

  select to_char(actual_date,'YYYY'), sum(value) from daily_data
  where sensor_id=?
  group by to_char(actual_date,'YYYY')

Any ideas?


--------------------------------------------------------

Anna Q. Fong, Webmaster 
California Data Exchange Center 

Reply via email to