SQL Server-在WHERE子句中使用CASE
发布于 2021-04-15 10:31:09
我想使用CASE
inWHERE
子句,但它返回错误。
我可以在where子句中使用CASE吗?或如何解决?谢谢
SELECT * FROM hris_leave.dbo.tbl_act
inner join hris_leave.dbo.tstaff on hris_leave.dbo.tstaff.s_id = hris_leave.dbo.tbl_act.s_id
where
case when acting_to is not null
then
datediff(day, acting_from, acting_to) >= 90 and acting_to >= '2010-10-01'
else
acting_to is null
order by hris_leave.dbo.tbl_act.s_id
关注者
0
被浏览
131
1 个回答