We help IT Professionals succeed at work.

sql query confusing me

starbase2
starbase2 asked
on
283 Views
Last Modified: 2012-05-11
Hello,

I have a table with all the acceses of the users to my website. In this table I just store the username and the date.

I need to get a list with the usernames that have logged in and how many times have they done it.

I'm confused about how can I use the 'group by' and 'count' modifiers to get this info.

Example:

Table:
user1, date1
user2, date2
user1, date 3
user1, date 4
user3, date5
user3, date6
user1, date 7

I will need to obtain the data:
user 1 - 3 times
user 2 - 1 time
user3 - 2 times

Probably it's trivial, but I can't handle it...
Thanks a lot and kind regards.
Comment
Watch Question

Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Rajkumar GsSoftware Engineer
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.