You can use RLIKE which is regular expressions then you should be able to execute

SELECT * FROM sometable WHERE surname RLIKE '^[A-C]' ORDER BY surname;

Kelley

Scott Brown wrote:

> Hi, List,
>
> I looked here:
>
> http://www.mysql.com/doc/en/String_comparison_functions.html
>
> But I am not seeing what I need.
>
> I want to do a string comparison like this:
>
> SELECT * FROM sometable WHERE surname LIKE '[A-C]%' ORDER BY surname;
>
> This works in another RDBMS. It doesn't return a syntax error, either, but
> it returns no records. My guess is that MySQL is interpreting the whole
> thing literally, rather than looking for what I want.
>
> I need this to return all records where surname begins with the letters A
> through C (that is, all records with a surname which begins with A, B, or C).
>
> Anybody got a how-to? I'm sure there must be some way, other than to do
> this three times. Some of these can vary; that is, it may be 0-9, or 0-Z
> (show all), even, so I don't want to do a bunch of OR'ing, either.
>
> Thanks!
> --Scott Brown
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to