Solved

SQL: Query amount and group by

Posted on 2014-12-17
2
81 Views
Last Modified: 2014-12-17
Hello

I have say a database like this: (cannot alter it!)

Username, logondate

What I want is to get a list of all Username's with the amount of logon's.

So:

James, 12/12/12 12:00:00
Wicked, 12/12/12 13:00:00
James, 12/12/12 12:00:00
Wicked, 12/12/12 13:00:00
Wicked, 12/12/12 14:00:00

What I want is:

James, 2
Wicked, 3

How can I do this?

Thanks
0
Comment
Question by:Ruttensoft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 33

Accepted Solution

by:
ste5an earned 500 total points
ID: 40504363
SELECT UserName, COUNT(*) FROM YourTable GROUP BY UserName;

Open in new window

0
 

Author Comment

by:Ruttensoft
ID: 40504393
Thanks!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question