[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Count Distinct

Posted on 2005-05-04
3
Medium Priority
?
216 Views
Last Modified: 2010-03-19
Hi..Please Help

I have a table with is a log of users interaction with a system.  each time the user uses the system it stamps the db with various details.  What i would like to do is create a query that shows me a count against each of the customers id

eg

user            date           action
abc           1.00 pm          A
xyz           1.05 pm           B
abc           1.10pm           C

i would liekt o generate a query that gives the result

user                       hits
abc                          2
xyz                           1


Thank you for your help

cafferm
0
Comment
Question by:cafferm
  • 2
3 Comments
 
LVL 28

Accepted Solution

by:
rafrancisco earned 2000 total points
ID: 13927302
Try this:

SELECT User, COUNT(*)
FROM YourTable
GROUP BY User
0
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13927307
SELECT User, COUNT(*) AS Hits
FROM YourTable
GROUP BY User
0
 

Author Comment

by:cafferm
ID: 13927348
Now thats fast - thank you very much
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Suggested Courses

872 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