Mysql Query to count common number in a column

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


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.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

C++ virtual function: Base class function is called instead of derived