Forums

This topic is locked

Infinite Loop

Posted 09 Feb 2005 13:36:32
1
has voted
09 Feb 2005 13:36:32 Chriz L. posted:
I have this SQL Statement...

SELECT table1.AppNo, table1.p_ID
FROM table1, table2
WHERE table1.p_ID NOT IN (SELECT table2.p_ID FROM table2);

(what i want to do is to select all records that are not contained in table2 [p_ID is unique])

Any suggestions What might goes wrong with this?

Thank you in advance!

Replies

Replied 09 Feb 2005 14:51:10
09 Feb 2005 14:51:10 Simon Martin replied:
Shouldn't need to list table2 in the From clause
SELECT AppNo, p_ID
FROM table1
WHERE p_ID NOT IN (SELECT p_ID FROM table2)

Live the life you love
Love the life you live
~ ~ ~ ~ ~ ~ ~
<b>Simon Martin</b> - <i>DMXzone Manager</i>
<font size=1>[ Dreamweaver MX/MX2004 | ASP | SQL | XHTML/CSS | Web Accessibility ] </font id=size1>

Reply to this topic