where( case when @time1<>@time2 then
(convert(char(10),so.PayDate,120) between @time1 and @time2)
case when @time1=@time2 then (convert(char(10),so.PayDate,120)=@time1))
求大神改改。如果@time1=@time2 条件就是 where convert(char(10),so.PayDate,120)=@time1
如果@time1<>@time2 条件就是 where convert(char(10),so.PayDate,120) between @time1 and @time2
...全文
37932打赏收藏
SQL where条件case when then
where( case when @time1@time2 then (convert(char(10),so.PayDate,120) between @time1 and @time2) case when @time1=@time2 then (convert(char(10),so.PayDate,120)=@time1)) 求大神改改。如果@time1=@time2 条件就是 where convert(char(10),so.PayDate,120)=@time1 如果@time
--你就用这一句就够了
where convert(char(10),so.PayDate,120) between @time1 and @time2
--当 @time1 = @time2 时,他与
where convert(char(10),so.PayDate,120)=@time1
--等价