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

DB2 SQL Query to fetch all instances of Salaries in one row


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

New User


Joined: 22 Sep 2018
Posts: 1
Location: India

PostPosted: Thu Sep 27, 2018 6:46 pm
Reply with quote

I have a Table as Below
EmpNum EmpName SalType Salary
100 Raja fixed 50,000
100 Raja variable 80,000
200 Rani fixed 60,000
300 Guru variable 100,000

Expected result
EmpName Salary Salary
Raja 50,000 80,000

The Instances of Raja can be more.
I have to fetch all the instances of salaries of the said employee.
I am unable to write a DB2 query for this.
Please help me.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Sep 27, 2018 8:26 pm
Reply with quote

see if
ibmmainframes.com/about51395.html
helps
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3049
Location: NYC,USA

PostPosted: Fri Sep 28, 2018 12:24 am
Reply with quote

How about simple CASE(SalType) and a Group by(EmpNum)?
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 Fetch data from programs execute (dat... DB2 3
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
Search our Forums:

Back to Top