----- Original Message -----
From: "Scott Mebberson" <[EMAIL PROTECTED]>
Sent: Wednesday, August 29, 2001 8:16 PM
Subject: [PHP-DB] Selection an id from a table where it doesn't exisit in

> Hi Guys,
> I have two tables, words and searchwords. words contains a list of words
> with an id number next to them and searchwords contains a page id with a
> word id (from the words table). I want to select all of the id's from the
> words table which does not exist in the word_id feild in the searchwords
> table.
> Make sense, it is for searching? Let me know if it doesn't.
> This is the SQL query I am running on MySQL (3.22) - SELECT id FROM words,
> searchwords WHERE words.id != searchwords.word_id;

Try this instead

select words.id from words LEFT JOIN searchwords ON words.id = searchword
s.word_id where searchwords.word_id is NULL;

> It isn't working. All it does it return a list of results which are
> incorrect.
> Thanks
> Scott.

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to