DB2 Query

Ask question on - DataBase Concepts, IBM Mainframe DB2, DB2/UDB, DB2 Tools, SQL , DB2 programming with languages like COBOL, PL1.

Moderators: Kalicharan, Moderator Group

Post Reply
pankaj_zenith2008
Member
Posts: 23
Joined: Wed Jul 29, 2009 4:54 pm
Location: chennai, Bangalore

DB2 Query

Post by pankaj_zenith2008 » Thu Nov 26, 2009 8:47 am

I have ONLY one table Tab1 having ONLY three columns as EmpId, EmpName, ManagerId.

I have to display EmpId and the Manager Name.


hint is :- the manager is also an employe of the compney.

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Thu Nov 26, 2009 3:44 pm

So, what's the question here? Do you need help to use that hint which you provide?
Regards,
Anuj

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Thu Nov 26, 2009 4:25 pm

so your homework is to develop SQL with a sub-select.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

pankaj_zenith2008
Member
Posts: 23
Joined: Wed Jul 29, 2009 4:54 pm
Location: chennai, Bangalore

Post by pankaj_zenith2008 » Mon Nov 30, 2009 8:48 am

sorry if you misunderstood the question, But I am unable to write this query.

N I gave the hint because-- this is what i hv to told to people to whom i hv asked this que, bt they were not able to answer. So i took the help of this FORUM so that i can have my que solved.

Can someone please show me the path to solution? :|

pankaj_zenith2008
Member
Posts: 23
Joined: Wed Jul 29, 2009 4:54 pm
Location: chennai, Bangalore

Post by pankaj_zenith2008 » Tue Dec 01, 2009 8:35 am

N one thing I can think of for this problem is,
I can use UNION to combine rows, thats what i comprehend, but finally no output.

User avatar
Natarajan
Moderator
Posts: 537
Joined: Fri Oct 10, 2008 12:57 pm
Location: chennai
Contact:

correlated subquery

Post by Natarajan » Tue Dec 01, 2009 11:17 am

Try using correlated subquery.

As i understand is from your question is, you need to display all employee details along with manager name.
Natarajan
Chennai

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others