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

Senior Moderator


Joined: 14 Mar 2007
Posts: 10727
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: 2588
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 Need Help with on of the coalesce query DB2 4
No new posts Fetch the Dataset names from inside m... TSO/ISPF 18
No new posts How to fetch the latest record from a... DFSORT/ICETOOL 8
No new posts Mainframe ISPREDIT Macro query TSO/ISPF 3
No new posts DFSORT Output file order query DFSORT/ICETOOL 2
Search our Forums:

Back to Top