select * from tablename where =AA%select * from tablename where =%BB%select * from tablename where =%CC
搞错了! 等等 select * from tablename where ='AA% 'select * from tablename where ='%BB% 'select * from tablename where ='%CC '
--怎么写SQL查出最前面的是AA, select * from tb where like 'AA%'--怎么写SQL查出中间的是DD, select * from tb where like '%-DD%'--怎么写SQL查出最后面的是EE, select * from tb where like '%EE'
--怎么写SQL查出最前面的是AA, select * from t where 字段 like 'AA%'--怎么写SQL查出中间的是DD, select * from t where 字段 like '%DD+'-'%'--怎么写SQL查出最后面的是EE, select * from t where 字段 like '%EE'
--怎么写SQL查出最前面的是AA, select * from t where charindex('AD-',col) < 2--怎么写SQL查出中间的是DD, select * from t where charindex('-DD-',col) < 4--怎么写SQL查出最后面的是EE, select * from t where charindex('-EE',col) > 5
like的根本不行呀,还有没有其他啊?
或者 select * from table where charindex('AA-',)>0 --最前面的是AA, select * from table where charindex('-DD-',)>0 --中间的是DD select * from table where charindex('-EE',)>0 --最后面的是EE
等等
select * from tablename where ='AA% 'select * from tablename where ='%BB% 'select * from tablename where ='%CC '
select * from tb where like 'AA%'--怎么写SQL查出中间的是DD,
select * from tb where like '%-DD%'--怎么写SQL查出最后面的是EE,
select * from tb where like '%EE'
--怎么写SQL查出最前面的是AA,
select * from t where 字段 like 'AA%'--怎么写SQL查出中间的是DD, select * from t where 字段 like '%DD+'-'%'--怎么写SQL查出最后面的是EE,
select * from t where 字段 like '%EE'
select * from t where charindex('AD-',col) < 2--怎么写SQL查出中间的是DD, select * from t where charindex('-DD-',col) < 4--怎么写SQL查出最后面的是EE,
select * from t where charindex('-EE',col) > 5
select * from table where charindex('AA-',)>0 --最前面的是AA,
select * from table where charindex('-DD-',)>0 --中间的是DD
select * from table where charindex('-EE',)>0 --最后面的是EE