IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

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 Member


Joined: 14 Mar 2007
Posts: 10695
Location: italy

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

see if
Use [URL] BBCode for Links
helps
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2508
Location: NY,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 All times are GMT + 6 Hours
Forum Index -> DB2
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
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
No new posts To fetch value separated by commas fr... DB2 3

Back to Top