Received: from send206.yahoomail.com (send206.yahoomail.com [205.180.60.172]) by hub.org (8.9.1/8.9.1) with SMTP id VAA01221 for ; Fri, 1 Jan 1999 21:38:01 -0500 (EST) (envelope-from peter_garner@yahoo.com) Message-ID: <19990102024050.4325.rocketmail@send206.yahoomail.com> Received: from [208.19.232.148] by send206.yahoomail.com; Fri, 01 Jan 1999 18:40:50 PST Date: Fri, 1 Jan 1999 18:40:50 -0800 (PST) From: Peter Garner Subject: Re: [SQL] SELECT DISTINCT To: pgsql-sql@hub.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Hi Tim, > select distinct fld_city, fld_zip from tbl_zip_city where fld_state='IA' and > fld_country='us'; > > That query does not return distinct cities any more. It returns all cities > (because each city can have several zip codes). > Yes, that is what it is supposed to do, heheheh. Try something like : select city, min (zip_code) from tbl_zip_city group by city having fld_state = 'IA' Basically since you have multiple zip codes and want only one per city you have to tell the sql engine which zip code to pick. It won't just select one at random. I hope this helps! :-) == Peace, Peter _________________________________________________________ DO YOU YAHOO!? Get your free @yahoo.com address at http://mail.yahoo.com