开发者

SQL query to count records

I have a table

EntryLog(Name String, Chec开发者_如何学运维kIn Boolean)

I want to count the number of checkins against each name. How do I write a query to get the result as a single resultset?


SELECT Name, COUNT(*) FROM EntryLog WHERE CheckIn GROUP BY Name


Try:

SELECT COUNT(1) FROM EntryLog WHERE CheckIn = 1 GROUP BY [Name]


SELECT name,
       COUNT(*)
    FROM EntryLog
    WHERE CheckIn
    GROUP BY name;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜