34,587
社区成员
发帖
与我相关
我的任务
分享
create table #tab
(
id int,
text char(1),
DataType bit,
IsError bit,
IsHandle bit
)
insert #tab
select 1 , 'a' , 1 , 0 , 0 union all
select 2 , 'b' , 1 , 1 , 0 union all
select 3 , 'c' , 1 , 1 , 1 union all
select 4 , 'd' , 1 , 0 , 0
select id from #tab where DataType=1 and IsError=0 or(IsError=1 and IsHandle=1)
id
-----------
1
3
4
(3 row(s) affected)