DB2 Question



IBM's flagship relational database management system

DB2 Question

Postby ganeshpande » Mon Sep 27, 2010 2:14 pm

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.
ganeshpande
 
Posts: 2
Joined: Wed Sep 01, 2010 2:00 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DB2 Question

 

Re: DB2 Question

Postby GuyC » Mon Sep 27, 2010 3:45 pm

group by and sum()
GuyC
 
Posts: 315
Joined: Tue Aug 11, 2009 3:23 pm
Has thanked: 1 time
Been thanked: 4 times

Re: DB2 Question

Postby mvnavinash » Mon Oct 04, 2010 8:23 pm

select state,sum(sal) from tablename groupby state....... I think It works...
mvnavinash
 
Posts: 5
Joined: Mon Oct 04, 2010 7:00 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DB2 Question

Postby NicC » Mon Oct 04, 2010 10:58 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: DB2 Question

Postby dick scherrer » Mon Oct 04, 2010 11:32 pm

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
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: DB2 Question

Postby mvnavinash » Wed Oct 13, 2010 7:48 am

K Nicc thanks for your suggestion.......
mvnavinash
 
Posts: 5
Joined: Mon Oct 04, 2010 7:00 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post