Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Studio question

Status
Not open for further replies.

Sidney786

Programmer
Aug 7, 2000
64
GB
Hi

I am trying to count the amount of times a user has logged on to the system.

I have user name, date/time, date extracted from date/time

User =============== Date/Time ================ Date
=====================================================
Adam =============== May 23, 2011 11:20:11===== May 23, 2011
Adam =============== May 23, 2011 12:20:11===== May 23, 2011
Adam =============== May 23, 2011 14:20:11===== May 23, 2011
Adam =============== May 25, 2011 11:20:11===== May 25, 2011
Adam =============== May 25, 2011 11:20:11 =====May 25, 2011
Annie=============== May 23, 2011 11:20:11===== May 23, 2011
Bill =============== May 27, 2011 11:20:11===== May 27, 2011


So what i want to see is Adam logged on 3 times on May 23 2 times May 25
Annie once and bill once.

At the moment i am get all the logins for Adam for the period he is registered on the system 560 time over 3 years.

Any suggestions?
 
Looks to me this is simply a matter of counting the distinct occurences of each date for each user:

In SQL:

SELECT USER,COUNT(DISTINCT DATE) FROM TABLE GROUP BY USER

Ties Blom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top