Hello..
I'm using PHP 4.11 with MySQL 2.3(?)
on a web host.
I have a database that shows names
and addresses (First, Last, addr1, addr2, etc.)
What i wanted to do was to select records showing last names starting with A, and ending with G.
I got it working, but with a very "Code-Heavy"
LIKE clause, and i want to simplify it.
basically it looks like this....
(the column for Last names == "Last")
SELECT * FROM table_name
WHERE ((Last LIKE \"A%\") OR (Last LIKE \"B%\") OR (Last LIKE \"C%\") OR (Last LIKE \"D%\"));
- and so on and so on,
adding a lot of OR conditions....
is a pain in the @ss !
I'd like to simplify the LIKE clause
so that MySql can return
the range of Last names that start
with an A, thru the Last names that start with an F.
I have tried numerous combinations
to get the same results searching
the range i listed above, but
combining the letters in brackets
and using single quotes,
WHERE Last LIKE '[A-F]%'
did not work, as did several variations
on this range type grouping and
escaping the single quotes didnt help either.....
Does anyone know the proper way
to achieve my result using the LIKE clause??
please email me at
adam_t@ftnetwork.com
Thanks;
Adam