|
-
fog,
You didn't provide any structure info, so I guessed that you have a table named mytable with two columns of interest: transdate and transprice.
select
decode(to_char(transdate,'MON'),
'JAN','1st Quarter ',
'FEB','1st Quarter ',
'MAR','1st Quarter ',
'APR','2nd Quarter ',
'MAY','2nd Quarter ',
'JUN','2nd Quarter ',
'JUL','3rd Quarter ',
'AUG','3rd Quarter ',
'SEP','3rd Quarter ',
'OCT','4th Quarter ',
'NOV','4th Quarter ',
'DEC','th Quarter '
) ||TO_CHAR(TRANSDATE,'YYYY') transquarter,
sum(transprice)
from mytable group by
decode(to_char(transdate,'MON'),
'JAN','1st Quarter ',
'FEB','1st Quarter ',
'MAR','1st Quarter ',
'APR','2nd Quarter ',
'MAY','2nd Quarter ',
'JUN','2nd Quarter ',
'JUL','3rd Quarter ',
'AUG','3rd Quarter ',
'SEP','3rd Quarter ',
'OCT','4th Quarter ',
'NOV','4th Quarter ',
'DEC','th Quarter '
) ||TO_CHAR(TRANSDATE,'YYYY')
order by substr(transquarter,16,19) asc, transquarter asc
/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|