开发者

SQL query to count records

开发者 https://www.devze.com 2023-01-08 05:39 出处:网络
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?SELE

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

精彩评论

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