List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:September 30 1999 8:45am
Subject:Re: substring mysql
View as plain text  
On Thu, 1999-09-30 10:36:45 +0300, Philips wrote:
> Paul DuBois wrote:
> > >SELECT field1 FROM table1 WHERE field1 IN (SELECT field2 FROM table2)
> >
> > SELECT table1.field1
> > FROM table1, table2
> > WHERE table1.field1 = table2.field2
> >
> 
> What about "NOT IN"?
> 
> SELECT field1 FROM table1 WHERE field1 NOT IN (SELECT field2 FROM table2)?

SELECT table1.field1
FROM table1 LEFT JOIN table2
     ON table1.field1 = table2.field2
WHERE table2.field2 IS NULL;

This is really a frequently ask (and answered!) question!

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Thread
substring mysqltvie29 Sep
  • Re: substring mysqlPaul DuBois30 Sep
    • Re: substring mysqlPhilips30 Sep
      • Re: substring mysqlMartin Ramsch30 Sep