Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

finding unique values between two tables, slightly complicated

Status
Not open for further replies.

AHinMaine

ISP
Nov 27, 2002
264
US
Basically I have table
Code:
location
with name, address, zip columns and another table with zips and their town names.

I want to get a list of only those town names that have entries in the location db.

This almost works.

Code:
select location.zipcode,towns.town,towns.zipcode from location 
left join towns on location.zipcode=towns.zipcode 
group by location.zipcode having towns.zipcode = location.zipcode
order by towns.town;

Towns with more than one zip get displayed more than once. --
Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top