List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 8 1999 2:37pm
Subject:Re: Left Join
View as plain text  
At 3:30 PM +0100 7/8/99, A. Brandic wrote:
>Trying to select records that exist in tableA but do not exist in tableB.
>
>select * from tableA LEFT JOIN tableB ON tableA.id=tableB.id where
>tableb.id=null;
>
>now, id is a primary key in both tables and it is integer not null.
>
>
>This query gives me an empty set but whereas I'm expecting 73 records
>which exist in tableA but not in tableB.
>
>Where m I making a mistake?

You can't use "=" to test for NULL.  Try tableb.id IS NULL instead:

select * from tableA LEFT JOIN tableB ON tableA.id=tableB.id where
tableb.id is null;

-- 
Paul DuBois, paul@stripped
Northern League Chronicles: http://www.snake.net/nl/
Thread
Japanese supportBruno A Posokhow8 Jul
  • Left JoinA. Brandic8 Jul
    • Re: Left JoinPaul DuBois8 Jul
      • Re: Left JoinA. Brandic8 Jul
  • Re: Japanese supporttakeshi8 Jul