Clarification:  What I'm trying to do is more akin to fiscal year, say from Oct to 
Sep.  For quarter, Steve Baldwin's answer works great!


> -----Original Message-----
> From: Steve Baldwin [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, November 14, 2002 12:12 PM
> To:   Fong, Anna; [EMAIL PROTECTED]
> Subject:      RE: Oracle Group By statement
> 
> 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