SELECT * FROM dbname WHERE text = 'a%' (this can get all the `text` fields which begin with the letter "a".)
但是如何获得第一个字母的字段!= [a-z]?
例如:
\"hello\" // this first letter begin as \ not range in a-z いけ // also first letter not begin range in a-z ... may also have a white space as the first character.
试试这个:
原文链接:https://www.f2er.com/php/130617.htmlSELECT * FROM dbname WHERE text REGEXP '^[^a-zA-Z]';
也就是说,如果您希望它不区分大小写(大写或小写).如果你想允许大写字母A-Z,那么只需使用:
SELECT * FROM dbname WHERE text REGEXP '^[^a-z]';
基本上,正则表达式表示匹配字符串开头没有字母a-z的任何字符串.