Mysql Query to count common number in a column

Multi tool use


Mysql Query to count common number in a column
I have a main table as first image and I need to produce output as second table. Can any one please help me to do mysql query.
Main Table
Output
1 Answer
1
You can do :
select anumber,
sum(tsp = 'aplace') as aplace,
sum(tsp = 'bplace') as bplace,
sum(tsp = 'cplace') as cplace
from table t
group by anumber;
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.