Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use decode to calculate sum for different date range

410182Dec 4 2003 — edited Dec 9 2003
I'm stuck with decode() function:

I have a table like this:

(project_id, approve_date, value, builder_code)

I want to write a SQL query to get sum of values for different month of the approve_date, and group by builder_code)

The result is like this:

builder_code Sum(value)_Sep-03 Sum(value)_Oct-03 Sum(value)_Nov03
1001 1,299 1,322 990
1002 3,332 1,222 333

I tried to use decode for this question but could not get the answer.

Thanks a lot

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 6 2004
Added on Dec 4 2003
6 comments
613 views