Re: MySQL BETWEEN Problems
| From: | Tony Grimes | Date: | Fri, 18 May 2007 21:12:23 +0000 |
| Subject: | Re: MySQL BETWEEN Problems | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-43620@lists.php.net to get a copy of this message | ||
Nice! That did the trick. Thanks Brad. I live to fight another day.
Tony
On 5/18/07 3:00 PM, "Brad Bonkoski" <bbonkoski@mediaguide.com> wrote:
> Try using the substr, since you are only comparing the first letters...
> (sorry I did not reply all on the other email, Dan)
>
> i.e.
>
> select name from users where substr(name, 1, 1) >= 'A' and substr(name,
> 1, 1) <= 'B';
>
> -B
> Dan Shirah wrote:
>> So just change it to WHERE last_name BETWEEN 'A' AND 'G' .
>> That'll
>> get you
>> Aa-Fz :)
>>
>>
>> On 5/18/07, Tony Grimes <contact@tonygrimes.com> wrote:
>>>
>>> We tried that and it didn't work. We've also tried every combination of
>>> upper and lower case too.
>>>
>>> Tony
>>>
>>>
>>> On 5/18/07 2:18 PM, "Brad Bonkoski" <bbonkoski@mediaguide.com> wrote:
>>>
>>>> I think you need between 'A' and 'F%'
>>>>
>>>> Aa is between A and F
>>>> but 'Fa' is not between 'A' and 'F'
>>>> (but 'Ez' would be between 'A' and 'F')
>>>> -B
>>>>
>>>>
>>>> Tony Grimes wrote:
>>>>> I'm using BETWEEN to return a list all people who's last names fall
>>> between
>>>>> A and F:
>>>>>
>>>>> .... WHERE last_name BETWEEN 'A' AND 'F' ...
>>>>>
>>>>> but it's only returning names between A and E. The same thing happens
>>> when I
>>>>> use:
>>>>>
>>>>> .... WHERE last_name >= 'A' AND last_name <= 'F' ...
>>>>>
>>>>> Shouldn't this work the way I expect it? What am I doing wrong?
>>>>>
>>>>> Tony
>>>>>
>>>>>
>>>>
>>>
>>> --
>>> PHP Database Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>