Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Join in SQL Query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
vickey_dw

New User


Joined: 10 Jun 2015
Posts: 51
Location: India

PostPosted: Tue Jan 17, 2017 12:15 am    Post subject: Join in SQL Query
Reply with quote

Hi All,

Table1 contains details of employee which i want to fetch based on comman key Sap id in table2.

I have written below query to fetch the details of a employee and its reporting maneger(RM)

Code:
Select
  A.Name
 ,A.Lastname
 ,A.Empid
 ,A.Telephone'
 ,B.Designation
 ,A.RM
 ,D.Name
 ,D.Lastname
 ,D.Empid
 ,D.Telephone
 ,D.RM
from Table1 A
    ,Table2 B
Left Join Table1 D
    on D.Empid = A.RM
Where
     A.Empid = '219057'
And  B.Sapid = A.Sapid


But i am facing problem to fetch designation of RM(Reporting manager) in above query as its present in table2. Please help me with this.
Back to top
View user's profile Send private message

RahulG31

Active User


Joined: 20 Dec 2014
Posts: 447
Location: USA

PostPosted: Tue Jan 17, 2017 11:37 am    Post subject: Reply to: Join in SQL Query
Reply with quote

Provide Sample data and expected output. Describe your requirement clearly and also what is the exact problem you are facing.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


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

PostPosted: Tue Jan 17, 2017 11:20 pm    Post subject:
Reply with quote

You already getting what you want unless you stated incorrectly.
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 Query on updating the control cards. abdulrafi DFSORT/ICETOOL 2 Tue Feb 26, 2019 2:23 pm
This topic is locked: you cannot edit posts or make replies. Query on updating the control cards. abdulrafi JCL & VSAM 2 Mon Feb 25, 2019 7:43 pm
No new posts Build SQL query using SORT balaji81_k DFSORT/ICETOOL 15 Mon Feb 18, 2019 9:56 am
No new posts General Query on DB2 table design subratarec DB2 3 Thu Feb 14, 2019 12:49 pm
No new posts SORT INNER JOIN [F1] OUT OF SEQ ERROR balaji81_k DFSORT/ICETOOL 8 Wed Jan 30, 2019 3:21 am

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