Welcome to WebmasterWorld Guest from 54.159.19.75

Forum Moderators: open

Message Too Old, No Replies

MySQL WHERE Comparison to Array

     
7:29 pm on Dec 28, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 24, 2003
posts:111
votes: 0


I want to creat a SQL statement that lets me SELECT recID FROM table WHERE refID!= [any existing values for recID in the current table]

I'm having a hard time figuring out how to compare a column in a where clause to an array from another column. Basically I want to locate orphaned records that used to reference other records that have since been deleted. I tried investigating JOIN statements, both those seem to only apply to data in another table, not the current one. Any ideas for me? Thanks in advance.

7:39 pm on Dec 28, 2005 (gmt 0)

Preferred Member

10+ Year Member

joined:Feb 16, 2005
posts:456
votes: 0


Something like:

SELECT recID FROM table WHERE refID not in (SELECT refID from...)

arran.