如何计算2个字段,然后得到一个区别

时间:2016-01-25 16:41:56

标签: sql

Select count(*) from column_alerts
Select count(*) from column_alerts where publish_datetime > (sysdate - (2/24/60))

显示column_alerts的差异 - (2分钟后添加的记录)

感谢

1 个答案:

答案 0 :(得分:1)

Select count(*) - sum(case when publish_datetime >(sysdate - (2/24/60)) then 1 else 0 end) from column_alerts