Solved

Sum sql query

Posted on 2014-10-31
2
115 Views
Last Modified: 2014-10-31
Hi,

I have a table with data looking as below:
Design of tableTable result
I would like to sum the different events so the result will be like this:
Event                Quantity
Processed        4
Delivered         4
Open                6
Click                 3

How should my query look like to make this happen?

Thanks for help!

Peter
0
Comment
Question by:peternordberg
2 Comments
 
LVL 15

Assisted Solution

by:Haris Djulic
Haris Djulic earned 250 total points
ID: 40415194
use this:

select event, count(*)
from customerGruopmailstatistics
group by event

Open in new window

0
 
LVL 5

Accepted Solution

by:
ReneD100 earned 250 total points
ID: 40415196
SELECT event, Count(event) AS Qty
FROM cgms
GROUP BY event;

Open in new window

0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how the fundamental information of how to create a table.

827 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