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;
精彩评论