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