SQL Query to return both distinct and total logins from a login table in sql2005

Posted by Prescott on Stack Overflow See other posts from Stack Overflow or by Prescott
Published on 2010-06-17T17:00:22Z Indexed on 2010/06/17 17:03 UTC
Read the original article Hit count: 147

Filed under:

Hey all,

I have a table Logins { Id, AccessTime }, I'd like to write a query that returns 3 columns, Total Logins during a time period, Unique Logins for a time period, and the Id of the user.

I know I could do this with two passes and a join, is there a better way to do it in a single pass?

Thanks, ~P

© Stack Overflow or respective owner

Related posts about sql-server-2005