我想查找商店开业时的员工人数
select COUNT(e.employeeID) as PunchCount
from StoreMonitoring as s
inner join
EmployeeInAndOut as e on e.storeMonitoringID=s.storeMonitoringID
where s.businessstarttime= (e.punchTime) and s.storeMonitoringID='12we'
group by e.employeeID
我想要这样
Total Emp At Open
-----------------
3
我如何实现这一目标?
答案 0 :(得分:0)
如果您想要员工的数量,请从组中删除e.employeeID并最终添加s.storeMonitoringID
select s.storeMonitoringID, COUNT(e.employeeID) as PunchCount
from StoreMonitoring as s
inner join
EmployeeInAndOut as e on e.storeMonitoringID=s.storeMonitoringID
where s.businessstarttime= (e.punchTime) and s.storeMonitoringID='12we'
group by s.storeMonitoringID