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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts SELECT from data change table DB2 5
Search our Forums:

Back to Top