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!

Query to grab the sum and the most recent values?

604073Oct 23 2007 — edited Oct 23 2007
hi,

Just wondering if its possible to have a query on the temp table,
which fetches school,most_recent(sub1),sum(sub2),sum(sub3) group by school


table temp

SCHOOL DATE1 SUB1 SUB2 SUB3
--------------------------------- --------- ---------- ---------- ----------
ABC 01-AUG-07 1 5 6
ABC 02-AUG-07 2 5 6
ABC 03-AUG-07 3 5 6
ABC 04-AUG-07 4 5 6
ABC 05-AUG-07 5 5 6
XYZ 01-AUG-07 6 7 8
XYZ 02-AUG-07 7 7 8
XYZ 03-AUG-07 8 7 8
XYZ 04-AUG-07 9 7 8
XYZ 05-AUG-07 10 7 8


Just wondering if its possible to have a query on the temp table,
which fetches school,most_recent(sub1),sum(sub2),sum(sub3)


required output

SCHOOL SUB1 SUB2 SUB3
------------- --------- ---------- ----------
ABC 5 25 30
XYZ 10 35 40

thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 20 2007
Added on Oct 23 2007
4 comments
244 views