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: 10621
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: 2245
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 Need to fetch data from database base... Satandale COBOL Programming 8 Sun Sep 08, 2019 12:01 am
No new posts DB2 Query runs very long John F Dutcher DB2 21 Wed Aug 21, 2019 11:44 pm
No new posts Query to Truncate value in table bhaskar_kanteti DB2 2 Mon Aug 12, 2019 3:26 pm
No new posts Verify WITH UR present inside program... priyankakir CLIST & REXX 23 Wed Jun 12, 2019 3:37 pm
No new posts Query on updating the control cards. abdulrafi DFSORT/ICETOOL 2 Tue Feb 26, 2019 2:23 pm

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