I have a table with 2 columns plateno
and alerts
.
table Data
plateno alerts
A 1
B 2
C 2
A 3
B 2
A 4
A 1
Now I want to get the result like this:
alerts-> 1 2 3 4
---------------------------
A 2 0 1 1
B 0 2 0 0
C 0 1 0 0
I mean 'A' has two alerts of type '1',1 alert of type '3' and '4'...and so on..
Here is my query I am trying with
Select count(alert)
from mytable
group by plateno