View previous topic :: View next topic
|
Author |
Message |
mflax
New User
Joined: 01 Sep 2006 Posts: 17 Location: Delhi
|
|
|
|
Can somebody help. I have to collect all the names who work under dept "XYZ". i mean i have to match the two id fields and then i have to check and for XYZ dept i have to collect all the names from first table.
TABLE_1
-------
ID1 NAME
TABLE_2
-------
ID2 DEPT |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi there,
SELECT TABLE_1.NAME
FROM TABLE_1, TABLE_2
WHERE TABLE_1.ID1=TABLE_2.ID2
AND TABLE_2.DEPT ='XYZ';
Hope it will useful |
|
Back to top |
|
|
prashanth1
New User
Joined: 27 Sep 2006 Posts: 47 Location: Hyderabad
|
|
|
|
SELECT A.EMP_NAME FROM TABLE_1 A, TABLE_2 B
WHERE A.ID1 IN (SLECT B.ID2 FROM TABLE_2 WHERE B.DEPT="XYZ");
Pls Correct Me, If I Wrng |
|
Back to top |
|
|
|