Wednesday, 15 June 2011

SQL show detail rows and aggregates for different time periods on same row -



SQL show detail rows and aggregates for different time periods on same row -

let's have query retrieves individual supplier transactions. need maintain details on each row see monthly, quarterly, , annual totals each supplier. how go this?

currently query output looks this

date month quarter year supplier value

i'd produce suppliermonthlytotal, supplierquarterlytotal, supplierannualtotal columns well.

you have utilize analytic function sum ... on ... partition by (see documentation oracle).

here have general informations analytic functions: http://docs.oracle.com/cd/e11882_01/server.112/e26088/functions004.htm

sql

No comments:

Post a Comment