Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > Finding records...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 15636 of 17437
Post > Topic >>

Finding records that are not there

by owen@[EMAIL PROTECTED] (Owen Hartnett) May 22, 2008 at 12:21 PM

Hi:

This is gotta be elementary SQL 101, but I'm having a mental block as 
to why this doesn't work.

I have two tables that have identical index fields, maplot and 
unitno, (both indexes span two columns) and I want to find all the 
records in the commcost table that don't have a corresponding record 
in the bldg file.

The SQL I've tried is:

select commcost.maplot, commcost.unitno from commcost
where not exists(select 1 from commcost, bldg
where commcost.maplot = bldg.maplot and
commcost.unitno = bldg.unitno)
order by commcost.maplot

It returns no records although I know that there are records in 
commcost which do not match keys with records from bldg.

Help!  What am I doing wrong?

-Owen

-- 
Sent via pgsql-general mailing list (pgsql-general@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
 




 3 Posts in Topic:
Finding records that are not there
owen@[EMAIL PROTECTED] (  2008-05-22 12:21:35 
Re: Finding records that are not there
owen@[EMAIL PROTECTED] (  2008-05-22 12:51:59 
Re: Finding records that are not there
Jon.Roberts@[EMAIL PROTEC  2008-05-22 11:50:47 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 12:17:35 CST 2008.