34,587
社区成员
发帖
与我相关
我的任务
分享
select (case when a - b < 0 then 0 else a - b end ) as c from tb
--1
select case when a - b < 0 then 0 else a - b end c from tb
--2
select a - b c from tb where a - b >= 0
union all
select 0 c from tb where a - b < 0
select case when a - b < 0 then 0 else a - b end c from tb