What's the difference between these SQL conditions?
Posted
by
wesley luan
on Stack Overflow
See other posts from Stack Overflow
or by wesley luan
Published on 2012-06-22T15:09:57Z
Indexed on
2012/06/22
15:16 UTC
Read the original article
Hit count: 179
Select * from Example
where
1 = Case when :index = 0 then
Case when DateEx Between :pDat1 and :pDate2 then 1 end
else
Case When :index = 1 or :index = 2 then
Case When DateEx >= :pDat1 then 1 end
end
end
And
Select * from Example
where
1 = Case when :index = 0 then
Case when DateEx Between :pDat1 and :pDat2 then 1 end
else 1
end
and 1 = Case When :index = 1 or :index = 2 then
Case When DateEx >= :pDat1 then 1 end
end
© Stack Overflow or respective owner