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
和
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