?
Solved

Sum sql query

Posted on 2014-10-31
2
Medium Priority
?
124 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
[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 15

Assisted Solution

by:Haris Djulic
Haris Djulic earned 1000 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 1000 total points
ID: 40415196
SELECT event, Count(event) AS Qty
FROM cgms
GROUP BY event;

Open in new window

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
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.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

719 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