且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

cloumn名称的where子句中的case

更新时间:2023-02-06 18:11:10

这样......

 选择 * 来自 A 其中(1 = 1) Isemailsend72 = 案例   @ hour  =  72   then   0   else   1  结束 



快乐编码!

:)


select * from A where (1=1) and case @hour when   72 then Isemailsend72 = 0 else IsEmailsend72=1 end 




this give me error ''Incorrect syntax near ''=''.''


Thanks.

This way...
select * from A where (1=1) and Isemailsend72 = case when  @hour = 72 then 0 else 1 end


Happy Coding!
:)