SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,423 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
hello,
I have a table which has daily datetimestamp and loginID
I would like to get a count of the LoginID for each month. How can I do this please?
Timestamp LoginId
2020-12-11T15:01:54.201000+00:00 B22
2020-12-11T15:32:36.403000+00:00 A5
...
Thank you
SELECT convert(char(6), Timestamp, 112), LoginID, COUNT(*)
FROM tbl
GROUP BY convert(char(6), Timestamp, 112), LoginID