Re: Selection an id from a table where it doesn't exisit in another
| From: | Dobromir Velev | Date: | Thu, 30 Aug 2001 07:19:07 +0000 |
| Subject: | Re: Selection an id from a table where it doesn't exisit in another | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-11986@lists.php.net to get a copy of this message | ||
Hi,
I think this should do the job
SELECT words.id FROM words left join searchwords on words.id =
searchwords.word_id where searchwords.word_id is Null;
Let me know if it is OK.
Dobromir Velev
-----Original Message-----
From: Scott Mebberson <scott@redbluedesign.com>
To: php-db@lists.php.net <php-db@lists.php.net>
Date: Thursday, August 30, 2001 4:17 AM
Subject: [PHP-DB] Selection an id from a table where it doesn't exisit in
another
>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;
>
>It isn't working. All it does it return a list of results which are totally
>incorrect.
>
>Thanks
>
>Scott.
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
>For additional commands, e-mail: php-db-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>