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: 44
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: 397
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: 1784
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 Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am

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