SELECT * FROM table1 t1 LEFT OUTER JOIN table2 t2 ON t1.field1=t2.field2
WHERE t2.field2 IS NULL
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Murad Nayal
Sent: Monday, December 09, 2002 11:38 AM
To: MySQL List
Subject: help on NOT EXISTS SQL
Thanks Adolfo,
this actually won't quite do the trick though. I should have been a bit
more specific. the query actually comes up in the context of
computational genomics. a similar, perhaps more familiar problem would
be something like this:
table
id customer purchase
1 c1 microwave
2
Hello Stefan,
thanks for the feedback. I think I probably misstated my problem. I just
emailed a more explicit example of the sort of thing I am trying to do.
for the sake of completeness I'll reproduce it here:
table
id customer purchase
1 c1 microwave
2 c1 car
3 c1
Dear Murad,
I know you can emulate an 'exists' subquery with a join. but I just
can't think of a way to emulate a 'not exists' without a subquery.
probably due to my limited sql experience. any hints?
You have probably tried something like SELECT ... WHERE condition IS NOT
NULL. To emulate a
I think i found a way to do this: in case anybody is interested:
select customer from purchases group by customer having sum(case when
purchase = 'freezer' then 1 else 0 end) = 0;
I am finding that SQL is trickier (and more powerful) than I thought
originally!!
Murad Nayal wrote:
Thanks