pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <joseph.conway@home.com>
To: bhuvansql@yahoo.com
Cc: pgsql-sql@postgresql.org
Subject: Re: How can we match a condition among 2 diff. tables?
Date: Fri, 13 Jul 2001 11:57:19 -0700
Message-ID: <009a01c10bcd$a5383510$47d310ac@jecw2k1> (raw)
References: <Pine.BSF.4.21.0107130842510.9706-100000@megazone23.bigpanda.com>

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




view thread (5+ messages)

Message-ID: <009a01c10bcd$a5383510$47d310ac@jecw2k1>
Permalink:  ../009a01c10bcd$a5383510$47d310ac@jecw2k1/
Also on:    postgresql.org/message-id/009a01c10bcd$a5383510$47d310ac@jecw2k1

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: joseph.conway@home.com, bhuvansql@yahoo.com
  Subject: Re: How can we match a condition among 2 diff. tables?
  In-Reply-To: <009a01c10bcd$a5383510$47d310ac@jecw2k1>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox