I would like to know if it's possible to make a query to check the first two chars of a string?
For example, I have these entries in my table:
toto
topo
poto
I want to get the entries when the two first chars are to
.
As simple as this:
SELECT *
FROM TABLE
WHERE `name` LIKE "to%"
to%
means that the word should start by to
and can be followed by other character
if you need to check the first 2 chars of a string but return all results..
SELECT fieldname,
if(left(fieldname,2)='XX',1,0) as XCheck
FROM tablename