SQL语句:select查询值必须不以”8”开头,但必须包含字符”8”;

如题所述

第1个回答  推荐于2018-05-13
下面是某个数据库中的ID号不以8开头但是中间必须包括8的查询语句。
select *
from 制单人信息表
where ID号 like '[^8]%8%'
切勿复制中文状态下输入的‘’,在查询分析器中会显示错误!最好自己写。
第2个回答  2010-07-28
select *
from tbName
where left(col,1)<>'8' and charindex('8',col)>0
第3个回答  2010-08-06
最直接的方法
select * from table where substring(字段名,1,1) !=‘8’and 字段名 like '%8%'
第4个回答  2010-07-28
select * from table where filed not like '8%' and filed like '%8%'本回答被提问者和网友采纳