-2
In a certain algorithm routine, the following data is recorded in a table:
Color Changed Led (Are two possible leds, code 2 to yellow, 3 to red) Reason for the Change (These are pre-defined reasons registered that the user selects at the time of the change)
below a table print
what I need is to make a query that returns 2 columns of COUNT, one for each led (leds 2 and 3), grouped by reason.
more or less in this format:
nomeMotivo | qtdAmarelo | qtdVermelho
Missing Tiles | 2 | 1
Maintenance | 3 | 2
In short, I need to know how many times each led was triggered in each motif
Search by PIVOT https://stackoverflow.com/questions/3561881/mysql-pivot-counting
– Motta