在2个日期内计算个别实例

时间:2017-10-18 08:50:16

标签: sql

我们有一定数量的房间,我需要的是在一定时间内计算房间的总面积

select count (OCCUid) as [Count of occupier],
       sum (datediff(day,Entry_Date,Leave_Date)) as [Count of Instances of stay]
from Tbl_room_activity
where Entry_Date between '01 april 2016' and '31 march 2017'
  and Leave_Date between '01 april 2016' and '31 march 2017'

0 个答案:

没有答案