Hi,
I have a table named ReportData which reportes activity for a small
but dynamic number of components
there are 2 columns: componentId and timeMeasurement

I want to defin a query which counts all the reports per each
component per year

I can do the following query
select year(timeMeasurement), componentId, count(*)
from ReportData
group by year(timeMeasurement), componentId

but I want to get the years as rows and the count per component as
columns like
        | component1 | component2 | component3
1999 | 150                205                0
2000 | 5645              6345               77
2001 | 6168              9168               669

and so on...

is it possible, remember that the number of components is dynamic
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"mysql" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/mysql
-~----------~----~----~----~------~----~------~--~---

Reply via email to