You should be able to do this from within the query. Try the following query:
DELETE users.*
FROM users
LEFT JOIN notes
USING(user_id)
WHERE notes.note_id IS NULL
Take care,
Floyd
On Dec 20, 2009, at 4:30 PM, דניאל דנון wrote:
> Hey, Lets assume I got a table named "users".
> It contains id & name.
>
> I have another table called "notes" - which contains id, user_id, contents
>
>
> I want to delete all users from table "users" that don't have notes (SELECT
> ... FROM notes WHERE user_id=ID) returns empty result.
>
>
> What is the fastest way to do it?
>
> --
> Use ROT26 for best security
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php