Re: [SQL] JOIN query not working as expected

2005-12-06 Thread Tom Lane
Mario Splivalo <[EMAIL PROTECTED]> writes: > I can create a FK on a column wich allows NULL values, and I can even > insert rows with NULLs in FK column, although PK table where FK is > pointing does not allow nuls. Is that 'by design', or...? It's per SQL spec. Add a NOT NULL constraint to the c

Re: [SQL] JOIN query not working as expected

2005-12-06 Thread Mario Splivalo
On Tue, 2005-12-06 at 09:58 -0500, Tom Lane wrote: > Mario Splivalo <[EMAIL PROTECTED]> 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_

Re: [SQL] JOIN query not working as expected

2005-12-06 Thread Tom Lane
Mario Splivalo <[EMAIL PROTECTED]> 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) >