At 22:39, 19990923, Chris Lambrou wrote:
>Hello, I need to get records in table a that don't exist in b
>So:
You want to use the left join trick.
mysql> select b.shopper_id
-> from sale_items b left join sales a
-> on (a.shopper_id = b.shopper_id)
-> where a.shopper_id is null;
That will find any sales that are not paired with a sale_item.
>mysql> select b.shopper_id
> -> from sale_items b, sales a
> -> where b.shopper_id <> a.shopper_id;
I'm sure that's not doing what you'd like. That's pretty much returning
a full join of the two tables, less a few rows....
Tim