How to get data in DB2 SQL, limit the number of rows returned and also SUM those rows for one column? -


I have a simple query that gives some records:

  as ref Select the reference, sum amtable as my name where foo_ref like 'b%' and foo_amount! = 0.000 only get 12 rows  

I would also like to do this amt column for sms these 12 returned rows i am a newbie for SQL so i'm not sure how to do this goes. Any help is appreciated.

What version of DB2 release and release? The current version has some powerful OLAP functionality.

with
  as the reference (select the reference as reference, the amount as amt from my.table where foo_ref 'b%' and foo_amount! = 0.000 by order referee first Receive 12 rows only) Select tbl *, Roll-up from TLB group as a tot_amt ((ref, AMT))  

This will return 13 rows with 13th, in which total_amat For the 12 rows, the total includes ref and AMT faucet.


Comments