如果前4个字符包含一个空格或更多空格,如何删除行,请参见示例
I try this
DELETE FROM table
WHERE substring(field,1,4) REGEXP '^[a-z ]+$';
+-----------+
| field |
+-----------+
| a asdad|
| aa asdad|
| aaa asdad|
| asda asdad|
| asd asdad|
| da asdad|
| a asdad|
+-----------+
+-----------+
| new values|
+-----------+
| asda asdad|
+-----------+
最佳答案
如果您得到所需的结果:
SELECT col FROM tab
WHERE substr(col,1,4) like '% %'
然后做:
DELETE FROM tab
WHERE substr(col,1,4) like '% %'