mysql查询以字符串开头的数据可以有:
1、select * from a where a.name like ‘H%’
2、select * from a where left(a.name, 1)=’H’;
mysql查询不以某个字符串开头:
select * from a where left(a.name, 1)<>’H’;
————————————————
版权声明:本文为CSDN博主「ZChangfeng」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/ZChangfeng/article/details/78032872
例子
update `dd`
set xzjd=
case
WHEN xzjd='330683001' then '剡湖街道'
WHEN xzjd='330683003' then '鹿山街道'
WHEN xzjd='330683004' then '浦口街道'
WHEN xzjd='330683100' then '甘霖镇'
WHEN xzjd='330683101' then '长乐镇'
WHEN xzjd='330683102' then '崇仁镇'
WHEN xzjd='330683103' then '黄泽镇'
WHEN xzjd='330683104' then '三界镇'
WHEN xzjd='330683107' then '仙岩镇'
WHEN xzjd='330683110' then '下王镇'
WHEN xzjd='330683111' then '石璜镇'
WHEN xzjd='330683112' then '谷来镇'
WHEN xzjd='330683113' then '金庭镇'
WHEN xzjd='330683206' then '贵门乡'
WHEN xzjd='330683002' then '三江街道'
else xzjd end
WHERE left(xzjd, 1)<>'330683';