Received: from zeus.houstoncellular.com (zeus.houstoncellular.com [206.109.152.194]) by hub.org (8.9.1/8.9.1) with ESMTP id OAA20949 for ; Tue, 12 Jan 1999 14:29:37 -0500 (EST) (envelope-from YoungblG@houstoncellular.com) Received: by SCORPEXC1.houstoncell.com with Internet Mail Service (5.5.2232.9) id ; Tue, 12 Jan 1999 13:29:04 -0600 Message-ID: <2B9713A99045D211BB4E0008C75668692EA7C1@SCORPEXC1.houstoncell.com> From: Greg Youngblood To: "'Tim Perdue, The Des Moines City.net'" , pgsql-sql@hub.org Subject: RE: [SQL] SELECT... BETWEEN 'P' and 'Z' Date: Tue, 12 Jan 1999 13:28:50 -0600 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2232.9) Content-Type: text/plain; charset="iso-8859-1" Try this: select distinct on fld_city fld_city, fld_zip from tbl_zip_city where fld_state = 'IA' and fld_country = 'us' and (substr(fld_city,1,1) between 'P' and 'Z') order by fld_city asc; That should look at the first letter and return what your looking for. Greg Gregory S. Youngblood ext 2164 -----Original Message----- Sent: Saturday, January 09, 1999 12:04 PM Subject: [SQL] SELECT... BETWEEN 'P' and 'Z' Hello all, I am trying to query a zip code database and pull all cities in a state in a range. According to the SQL tutorial that the pgsql site recommended, using "between" in your select should be "inclusive". However, my selects are including the first letter "p" through "y", and excluding "z". My SQL: select distinct on fld_city fld_city, fld_zip from tbl_zip_city where fld_state = 'IA' and fld_country='us' and (fld_city BETWEEN 'P' AND 'Z') ORDER BY fld_city ASC; Any suggestions on how I could get the cities that start with "Z" to be included here (P is included strangely enough)?