select * from [table]
where case
when id=2 and getdate() between startdate and enddate then 1
when id<>1 and id<>2 then 1 else 0 end=1
where case
when id=2 and getdate() between startdate and enddate then 1
when id<>1 and id<>2 then 1 else 0 end=1
select * from [table]
where (id<>1 and id<>2)
or (id=2 and getdate() between startdate and enddate)
where id not in(1,2)
or (id=2 and getdate() between startdate and enddate)
且在 id = 2 AND flag = 1 时
还有另外两个条件
startdate >= getdate() AND
enddate <= getdate()