Results 1 to 8 of 8
Jan 16, 2005, 07:16 #1
- Join Date
- Sep 2004
- 0 Post(s)
- 0 Thread(s)
How to select tables with records existing in another table?
I am having trouble writing a select statement to get some records from one table with a reference ID existing in another record. For example.
Table X has ID 1,2,4,6,9. And Table Y has ID 1,2,3,4,5,6,7,8,9.
How can I retrieve all the records in Table Y that has the ID 1,2,4,6 & 9 without using a do while loop?
I tried using the statement "select * from table Y where exists (select * from table X where Y.ID=X.ID)". But only one record is shown. Can any one explain why?