I have a table with 3 columns:
COLUMN A: DATETIME
COLUMN B: DOUBLE
COLUMN C: INT
Column A is not unique there are many rows with the same DATETIME
value, however for every DATETIME
COLUMN C is unique.
Background: Somebody measured on 5 different positions a temperature and this is stored in the database as:
COLUMN A | COLUMN B | COLUMN C
12:00 | 23.4 | 4
12:00 | 24.4 | 5
12:00 | 25.4 | 6
12:01 | 26.4 | 4
12:01 | 27.4 | 5
12:01 | 28.4 | 6
I would like to transform this (in a new table or view) into something like:
COLUMN AA | COLUMNC_VALUE-4 | COLUMNC_VALUE-5 | COLUMNC_VALUE 6
12:00 | 23.4 | 24.4 | 25.4
12:01 | 26.4 | 27.4 | 28.4
The values in Column C can be found in another table.
Is this possible in SQL or do I have to write some code?