Solved

SQL: Query amount and group by

Posted on 2014-12-17
2
75 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
2 Comments
 
LVL 32

Accepted Solution

by:
Stefan Hoffmann 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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.…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now