Re: JOIN query not working as expected - Mailing list pgsql-sql

From Tom Lane
Subject Re: JOIN query not working as expected
Date
Msg-id 164.1133881091@sss.pgh.pa.us
Whole thread Raw
In response to JOIN query not working as expected  (Mario Splivalo <mario.splivalo@mobart.hr>)
Responses Re: JOIN query not working as expected  (Mario Splivalo <mario.splivalo@mobart.hr>)
List pgsql-sql
Mario Splivalo <mario.splivalo@mobart.hr> writes:
> Now I want all services which didn't have any messages within certain
> period:
> pulitzer2=# select * from services where id not in (select distinct
> service_id from messages where receiving_time between '2005-10-01' and
> '2005-10-30');
> (0 rows)

> Why is that?

Probably, you've got some NULLs in the messages.service_id column ...
try excluding those from the sub-select.
        regards, tom lane


pgsql-sql by date:

Previous
From: Michael Burke
Date:
Subject: Re: Database with "override" tables
Next
From: Mario Splivalo
Date:
Subject: Re: JOIN query not working as expected