0

I am trying to count/add multiple rows with a same column value.

As an example:

aid | uid | name              | region         | timestamp
17  | 43  | Max Payne         | Western Europe | 1507677429
101 | 91  | Jeffrey Birchwood | North America | 1509586239
45  | 109 | Richard Branson   | North America | 1509536026
167 | 133 | Soenke Tapaz      | North America | 1510603831
23  | 431 | Sophie Turner     | Western Europe | 1508166970
187 | 431 | Sophie Turner     | Western Europe | 1511190350
19  | 431 | Sophie Turner     | Western Europe | 1507887993
169 | 431 | Sophie Turner     | Western Europe | 1510612773
161 | 431 | Sophie Turner     | Western Europe | 1510574362
207 | 431 | Sophie Turner     | Western Europe | 1511788946
145 | 431 | Sophie Turner     | Western Europe | 1510138206
189 | 431 | Sophie Turner     | Western Europe | 1511196429
8   | 445 | Faisal Riaz       | North America | 1507583110
33  | 445 | Faisal Riaz       | North America | 1509480510
12  | 445 | Faisal Riaz       | North America | 1507659660
217 | 445 | Faisal Riaz       | North America | 1511914655
7   | 445 | Faisal Riaz       | North America | 1507560542
25  | 449 | Venkat Puri       | North America | 1508509764
121 | 449 | Venkat Puri       | North America | 1509704227
119 | 449 | Venkat Puri       | North America | 1509704171
117 | 449 | Venkat Puri       | North America | 1509703793
5   | 463 | Scott Jay         | North America | 1507301571
21  | 463 | Scott Jay         | North America | 1507910814
27  | 465 | Parker Tates      | EEMA          | 1509109957
29  | 467 | Vivian Bond       | Western Europe | 1509465890
31  | 469 | Jean-Christophe Glachant | Western Europe | 1509474304
35  | 471 | Arnab Goswami     | North America | 1509535475
37  | 473 | Matthias Toby     | Western Europe | 1509535623
39  | 475 | Shubham Sawdhan   | North America | 1509535625
41  | 477 | Martin Hoffmann   | Asia | 1509535626

Goal

What I am trying to do is to count each occurance region. Hence my result would be:

Region           | Count

Western Europe   | 12
North America    | 16
Asia             | 1
EEMA             | 1

Thanks

1
  • Your query has nothing to do with the results you want to achieve. Just use Group By clause. Commented Nov 29, 2017 at 4:01

1 Answer 1

2

You would simply use group by:

select region, count(*)
from t
group by region;

I have no idea what your query has to do with the question.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.