> > The question is how can I use some sort of statement using > mysql and php > > to select all rows between 1 and 0 NOT 0 and 9 like the > above statement > > performs.
Sure, an option was nicer, but isn't the following possible? SELECT ... WHERE ... AND ( x BETWEEN 1 AND 9 OR x BETWEEN 0 AND 1 ) Regards, TomH -- PROSOFT EDV-Lösungen GmbH & Co. KG Geschäftsführer: Axel-Wilhelm Wegmann AG Regensburg HRA 6608 USt.183/68311 Verwaltung : 93053 Regensburg, Stadlerstraße 13 office : 93049 Regensburg, Ladehofstraße 28 www : http://www.proSoft-Edv.de email : [EMAIL PROTECTED] phone : +49 941 / 78 88 7 - 121 fax : +49 941 / 78 88 7 - 20 cellphone : +49 174 / 41 94 97 0 -- > -----Original Message----- > From: Director General: NEFACOMP [mailto:[EMAIL PROTECTED] > Sent: Tuesday, October 21, 2003 11:11 AM > To: Steven Ducat; [EMAIL PROTECTED] > Subject: Re: SELECT 9 BETWEEN 1 AND 0 > > > I am sorry to say that your question is not clear. > Why don't you send us a simple Table with few data and what > you want to > achieve in simple terms? I mean a more clear question!!! > Have tried using IN(). > In your subject, you said 9 BETWEEN 1AND 0????? I am confused. > > > Thanks > Emery > ----- Original Message ----- > From: "Steven Ducat" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, October 21, 2003 08:12 > Subject: SELECT 9 BETWEEN 1 AND 0 > > > > I am trying to create a select query to find the post town > of a users > > post code. I am using Royal Mails (UK) post town gazetteer. > UK Postcode > > (eg. RH6 9XJ). The first column contains the first half of > the post code > > (eg. RH6) and the next column holds the range of the second > half (eg. > > 2AA-6PP). > > > > I have some code as follows: > > <?php > > $pc = explode(" ","RH6 9XJ"); > > > > "SELECT postTown, postCode, SUBSTRING(postSector,1,3) as a, > > SUBSTRING(postSector,5,3) as b, postCounty FROM postCode > WHERE postCode > > = \"".$pc[0]."\" AND \"".$pc[1]."\" BETWEEN > SUBSTRING(postSector,1,3) > > AND SUBSTRING(postSector,5,3)"; > > ?> > > > > This will return 1 row for example if the first column was > "RH6" and the > > second column was "8ZZ-9ZZ". > > > > But in the post town list the range goes from 1 - 0 (eg. 1AA-0ZZ) so > > what I find is if I use the postcode "RH6 9XJ" and a first > column of RH6 > > and a second column of 7AA-0BW it will not return the row > as it does not > > count from 1 - 0. > > > > > > > > What I really need is some sort of function where I can set > the range > > that the between option sorts from. > > > > I have been trying to solve this for some weeks now. > > > > Thank You. > > > > Steve. > > > > > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/mysql?unsub=mysql-list@> 7thweb.de > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]