Is there a way to search for records where a fields starts with either a number or symbols such as !,@,#,$,%,&,* ?
Printable View
Is there a way to search for records where a fields starts with either a number or symbols such as !,@,#,$,%,&,* ?
select yourfield
from yourtable
where yourfield regexp "[^[:alpha:]]"
or something like that, check REGEXP in the manual
Well this is the code i have so far for the numbers, can't figure out how to get symbols to work with this though:
SELECT field FROM table WHERE LEFT(field, 1) BETWEEN '0' AND '9'
well, if you don't want to look up REGEXP, you could tryCode:where not (lcase(left(field, 1)) between 'a' and 'z')
No one said I wasn't going to look :). I will soon. Thanks.
Ok I am trying to figure it out:
SELECT field FROM table WHERE field = REGEXP [[:alnum:]]+
or
SELECT field FROM table WHERE REGEXP '^!@#$%^&*()1234567890'
:agree: