Re: How can we match a condition among 2 diff. tables? - Mailing list pgsql-sql

From Joe Conway
Subject Re: How can we match a condition among 2 diff. tables?
Date
Msg-id 009a01c10bcd$a5383510$47d310ac@jecw2k1
Whole thread Raw
In response to Re: How can we match a condition among 2 diff. tables?  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-sql
> >  Now, i need to get the details of all employees who did 
> >  receive NONE of the salesorders. ie.. i wish to select the 
> >  records of table 'employee' whose 'emp_id' are not 
> >  there in table 'salesorder'.
> >  
> >  I need to accompolish in a single query!

This should work:

select e.emp_id
from employee as e left join salesorder as s on e.emp_id = s.emp_id
where s.emp_id is null;


-- Joe



pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: You have an error in your SQL syntax near '' at line 1
Next
From:
Date:
Subject: Re: Date Validation?