I could do with something I can’t figure out how to do. I have a simple query that I need to aggregate and condense. Here is the base script:
select t.serial, t.make, t.model, t.upgrade_date, t.software_version
FROM table t
Order by t.serial
These are electrical devices that have been software upgraded (up to 3 times). The script above, of course, will provided multiple rows for the same device but with varying software versions while the make and model remain constant. I understand how to aggregate this to a single row using max to, for example, show the latest software version. However, what I need is to aggregate and have a condensed column showing EVERY software_version (in order) the device has been at.
It could look like this:
+------------------------------------------+
| Serial | Make | Model | Version_history |
+------------------------------------------+
| A Terra 1 1.1, 1.9, 2.1 |
+------------------------------------------+
Alternatively, and possibly better, it would be fine to show each software_version as a column header with ‘upgrade_date’ if the device was at that version. Actually, it would be useful to know both methods.
This could look like this:
+------------------------------------------------------------------------+
| Serial Make Model 1.1 1.9 2.1 2.3 |
+------------------------------------------------------------------------+
| A Terra 1 01-Jan-2019 17-Jun-2019 31-Dec-2019 |
+------------------------------------------------------------------------+
No doubt this is really simple but I can’t for the life of me figure it out.