我正在构建这个select语句,并且达到了我的条件不起作用的程度。这是代码:
select *
from (
select ref,usr1,design,forref,replace(stock,'.',',')as stock
from st
where inactivo like '0'
and usr1 not in ('Serv','Reciclagem','portes','pbl','ctb','')
and forref not in ('','0')
) total
where ref not in ('10159%','13159%')
order by usr1
问题是,当我写行以排除ref表上的某些值时,没有任何反应。
where ref not in ('10159%','13159%')
哪里错了?
答案 0 :(得分:0)
尝试使用
WHERE LEFT(ref, 5) NOT IN ('10159','13159')
HTH!
感谢。