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

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: bhuvansql(at)yahoo(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: How can we match a condition among 2 diff. tables?
Date: 2001-07-13 15:43:54
Message-ID: Pine.BSF.4.21.0107130842510.9706-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Something like?

select employee.* from employee where
not exists (select * from salesorder where
salesorder.emp_id=employee.emp_id);

On Fri, 13 Jul 2001 bhuvansql(at)yahoo(dot)com wrote:

>
>
> Hi,
>
> Consider the below...
>
> table 'employee' with unique 'emp_id',
> table 'salesorder' with 'emp_id' and unique 'sales_id'
>
> Remember, both tables include some more different fields.
>
> 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!

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2001-07-13 16:18:19 Re: How can we match a condition among 2 diff. tables?
Previous Message Josh Berkus 2001-07-13 15:24:36 Date Validation?