I am working on a aggregate report and I have got so far with the data but I am unsure how to proceed from here. I get by with SQL but my skills are limited
I have the follow in a temp table
ID Count Action
2 23 Installed
2 12 Uninstalled
2 36 Unchanged
3 12 Installed
3 25 Unchanged
4 35 Installed
4 25 Unchanged
I want to convert this into this format
ID Installed Uninstalled Unchanged
2 23 12 36
3 12 0 36
4 35 0 25
I have no idea where to go or even how to start to achieve this and cannot find anything to point me in the right direction (Im sure its there somewhere)
Any help would be appriciated
Try this:
Or using the SQL Server
PIVOTtable operator like so:SQL Fiddle Demo for both
However, for unknown number of
Actions, you will have to select them dynamically like so:SQL Fiddle Demo(Dynamic Version)