有数据表test:
pno loc
p001 L100
p002 L200
p003 L300SQL:
select * from test where charindex(rtrim(loc),'L100,L300,')=1
结果只有一条:
pno loc
p001 L100按我的设想应该有两条记录才对:
pno loc
p001 L100
p003 L300请问如何写才会找出两条记录?
pno loc
p001 L100
p002 L200
p003 L300SQL:
select * from test where charindex(rtrim(loc),'L100,L300,')=1
结果只有一条:
pno loc
p001 L100按我的设想应该有两条记录才对:
pno loc
p001 L100
p003 L300请问如何写才会找出两条记录?
--改成大于0,你好好看看charindex函数的说明
select * from test where charindex(rtrim(loc),'L100,L300,')>0