how compare string to integer in query
Posted: Wed Feb 23, 2011 6:31 pm
I want to perform a query which returns a subset of the fields in a mySQL table.
A query like this:
returns all names which begin with 'S'.
But if I make this query:
only returns about a dozen of the values 3, 30-39, 300-399, etc. (The field is VARCHAR and contains numerals.)
How can I accomplish this query?
thanks,
Tom
A query like this:
Code: Select all
$query = mysql_query("SELECT * FROM table WHERE name LIKE 's%'") ;But if I make this query:
Code: Select all
$query = mysql_query("SELECT * FROM table WHERE code LIKE '3%"') ;How can I accomplish this query?
thanks,
Tom