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: 2066
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 Fetch first first row in inner join! Vignesh Sid DB2 9 Tue Dec 04, 2018 7:25 pm
No new posts Query on secondary index Suja.Sai IMS DB/DC 1 Wed Oct 31, 2018 9:47 pm
No new posts Query regarding STOP REGION XX ABDU... ashek15 IMS DB/DC 11 Fri Oct 19, 2018 10:13 am
No new posts Facing issue while executing multi ro... aagarwal88 DB2 6 Tue Oct 02, 2018 8:11 am
No new posts DB2 SQL Query to fetch all instances ... MallikarjunSM DB2 2 Thu Sep 27, 2018 6:46 pm

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