这种语句有什么办法简写?该如何处理
这种语句有什么办法简写?SQL codeselect (case when [员工编号] in (634,3283,3332) then 5 end ) f
这种语句有什么办法简写?
SQL codeselect (case when [员工编号] in ('634','3283','3332') then 5 end ) from #AT想在case加一个判断如果员工的进厂时间大于15号就返回NULL,在15号前进厂的返回5,这样的要怎么写才好
[解决办法]可以用union all
select 5,* from tb where 15号之前
union all
select null,* from tb where 大于15号
[解决办法]select (case when [员工编号] in ('634','3283','3332') and day(时间) < 15 then 5 else null end ) from #AT
[解决办法]select case when 进厂时间>15 then null else 5 end as ... from tbl where [员工编号] in ('634','3283','3332')