IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DB2 Query to select a group


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Tue Mar 30, 2010 3:19 pm
Reply with quote

Hi,
I need a help below is the data in a table

Prod Name Comp Prod Price
A WM 40
B Best 60
C Best 70
D WM 100

and i need the o/p as
Comp
WM 140
Best 130
Back to top
View user's profile Send private message
Abijoy

New User


Joined: 24 Mar 2010
Posts: 12
Location: Bangalore

PostPosted: Tue Mar 30, 2010 3:41 pm
Reply with quote

Anand,

Try this.
Code:
SELECT COMP,SUM(PRODPRICE)                     
FROM TABLE       
WHERE 'condition'
GROUP BY COMP 


Thanks
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts DB2 Query to get the count of Unique ... DB2 2
No new posts Extract records for a specific condit... DFSORT/ICETOOL 25
No new posts Need help with ADABAS query (COBOL-AD... All Other Mainframe Topics 1
No new posts Inserting into table while open selec... DB2 1
No new posts RC query -Time column CA Products 3
Search our Forums:


Back to Top