"Christian Dechery" <[EMAIL PROTECTED]> wrote:
> I have a table A and a table B... I want all occurences from A there are
> not in B...
>
> in ANSI SQL... it's nothing more than:
>
> select a.id, a.name from table_a a, table_b b where a.id NOT IN (select id
> from table_b)
>
> and that's it... but in Mysql, since there are no sub-selects, I'm burning
> my brains out and not getting it... I don't wanna create a temp table like
> the manual suggests... this is way NOT efficient... I'd rather do it in
PHP
> code than having a query that creates a temporary table, then drop it...
No temp table necessary. Use a LEFT JOIN.
SELECT * FROM table_a
LEFT JOIN table_b
ON table_a.id = table_b.id
WHERE table_b.id IS NULL
--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/
--
PHP General 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]