use pubscreate view test as
select stor_id,ord_num,qty,payterms,first1=0,second1=0,third1=NULL
FROM SALES
select * from test
where stor_id='6380'
and not ((first1=0 and third1=100) or (first1=0 and second1=1 and third1=100) or (first1=0 and third1>0))
这个写法是以前公司一位前辈写的,现在被提为BUG.
请高手分析下问题在哪,应该有两条数据才对,可加没加NOT,查出来都没数据。
谢谢
select stor_id,ord_num,qty,payterms,first1=0,second1=0,third1=NULL
FROM SALES
select * from test
where stor_id='6380'
and not ((first1=0 and third1=100) or (first1=0 and second1=1 and third1=100) or (first1=0 and third1>0))
这个写法是以前公司一位前辈写的,现在被提为BUG.
请高手分析下问题在哪,应该有两条数据才对,可加没加NOT,查出来都没数据。
谢谢
这种在sybase,oracle,mysql中是可行的,sqlserver里必须用 is (not) null
记住在sqlserver里 =null 只有赋值时才有效。