Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
DB2 SQL Query to fetch all instances of Salaries in one row

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: DB2 SQL Query to fetch all instances of Salaries in one row
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: 10690
Location: italy

PostPosted: Thu Sep 27, 2018 8:26 pm    Post subject: Reply to: DB2 SQL Query to fetch all instances of Salaries in one row
Reply with quote

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

Senior Member


Joined: 21 Sep 2010
Posts: 2419
Location: NY,USA

PostPosted: Fri Sep 28, 2018 12:24 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fetch the Dataset names from inside m... kalyan94 TSO/ISPF 18 Wed Jun 17, 2020 2:06 pm
No new posts How to fetch the latest record from a... Dinesh Mani DFSORT/ICETOOL 8 Tue Jun 02, 2020 5:34 pm
No new posts Mainframe ISPREDIT Macro query upendrasri TSO/ISPF 3 Wed May 27, 2020 1:12 pm
No new posts DFSORT Output file order query A_programmers DFSORT/ICETOOL 2 Thu Mar 26, 2020 11:59 pm
No new posts To fetch value separated by commas fr... vinu78 DB2 3 Fri Feb 28, 2020 12:56 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us