Re: How can we match a condition among 2 diff. tables?

From: A_Schnabel(at)t-online(dot)de (Andre Schnabel)
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: How can we match a condition among 2 diff. tables?
Date: 2001-07-13 16:41:29
Message-ID: 003001c10bba$ab3849e0$0201a8c0@aschnabel.homeip.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

if you translate your (english) idea striktly to SQL, you'll make it ;-)

> 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'.

SELECT * FROM employee
WHERE emp_id NOT IN (
SELECT emp_id FROM salesorder
);

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2001-07-13 17:04:52 Re: Date Validation?
Previous Message Stephan Szabo 2001-07-13 16:39:44 Re: Date Validation?