Page 1 of 1

DB2 Question

PostPosted: Mon Sep 27, 2010 2:14 pm
by ganeshpande
custno Model state salesamt
111 AAA OOO 1000
111 AAA ppp 3000
222 BBB PPP 2000
111 CCC RRR 2500
333 DDD SSS 2700
444 DDD SSS 2700
444 DDD DDD 2700

Question is find out total amount of sales in for each state. e.g For state SSS total amount sales is 5400.

Re: DB2 Question

PostPosted: Mon Sep 27, 2010 3:45 pm
by GuyC
group by and sum()

Re: DB2 Question

PostPosted: Mon Oct 04, 2010 8:23 pm
by mvnavinash
select state,sum(sal) from tablename groupby state....... I think It works...

Re: DB2 Question

PostPosted: Mon Oct 04, 2010 10:58 pm
by NicC
mvnavinash wrote: I think It works...

Well, before you post you should test it.

Also, the idea is not to give the answer but to give clues as to how to go about getting the answer. That way the poster can look things up and learn.

Re: DB2 Question

PostPosted: Mon Oct 04, 2010 11:32 pm
by dick scherrer
Hello ganesh and welcome to the forum,

When asking a question a meaningful subject should be used for your topic. Posting a question with a subject of "DB2 Question" in the DB2 part of the forum is rather meaningless. . .

Good luck :)

d

Re: DB2 Question

PostPosted: Wed Oct 13, 2010 7:48 am
by mvnavinash
K Nicc thanks for your suggestion.......