2017-12-19 11 views
0

私はこの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%') 

どこが間違っていますか?

+1

'%'はワイルドカードであるはずですか?そうであれば、2つの別々の条件でANDとの間で 'not like 'が必要です。 –

+1

完璧、ありがとう! – questionador

答えて

0

WHERE LEFT(ref, 5) NOT IN ('10159','13159') 

HTHを使用してみてください!

ありがとうございました。