我有一张桌子
EntryLog(Name String, CheckIn Boolean)
我想计算每个名字的签到次数。如何编写查询以将结果作为单个结果集?
答案 0 :(得分:5)
SELECT Name, COUNT(*) FROM EntryLog WHERE CheckIn GROUP BY Name
答案 1 :(得分:5)
尝试:
SELECT COUNT(1) FROM EntryLog WHERE CheckIn = 1 GROUP BY [Name]
答案 2 :(得分:3)
SELECT name,
COUNT(*)
FROM EntryLog
WHERE CheckIn
GROUP BY name;