?
Solved

SQL: Query amount and group by

Posted on 2014-12-17
2
Medium Priority
?
84 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 35

Accepted Solution

by:
ste5an earned 2000 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month10 days, 18 hours left to enroll

770 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