View previous topic :: View next topic
|
Author |
Message |
Satyajit
New User
Joined: 25 Jan 2006 Posts: 27
|
|
|
|
How can I get the detail of multiple rows from employee table?
here im getting it for EMP_NO '100005' only. I want the details for EMP_NO '100003' with this.
---------+---------+---------+---------+---------+---------+---------+--
SELECT A.EMP_NO,A.FIRST_NAME,A.LAST_NAME,A.PROJECT_NO,
B.PROJECT_NO,B.LOCATION,B.MGR_NAME
FROM U110760.EMPLOYEE A,
U110760.PROJECT B
WHERE A.PROJECT_NO = B.PROJECT_NO
AND A.EMP_NO = '100005';
---------+---------+---------+---------+---------+---------+---------+--
EMP_NO FIRST_NAME LAST_NAME PROJECT_NO PROJECT_NO LOCATION
---------+---------+---------+---------+---------+---------+---------+--
100005 RAKESH BISWAS 1002 1002 CTS TCX
DSNE610I NUMBER OF ROWS DISPLAYED IS 1
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Code: |
SELECT A.EMP_NO,A.FIRST_NAME,A.LAST_NAME,A.PROJECT_NO,
B.PROJECT_NO,B.LOCATION,B.MGR_NAME
FROM U110760.EMPLOYEE A,
U110760.PROJECT B
WHERE A.PROJECT_NO = B.PROJECT_NO
AND A.EMP_NO IN ('100005', '100003')
;
|
Dave |
|
Back to top |
|
|
parikshit123
Active User
Joined: 01 Jul 2005 Posts: 269 Location: India
|
|
|
|
Hi,
What Dave has suggested is a correct query.
But, I wonder, will it not be a good idea to do restrict first and then join?
May be we can use JOIN keyword to do this?
Just an idea not sure if suits your requirement. |
|
Back to top |
|
|
|