I have table in my database that goes like this:
ID | VARIANT | SIFRANT | VALUE
When I call
SELECT * FROM example_table I get each row on its own. But records in my database can have the same VARIANT. And I'd like to output those records them in the same row. for example if I have
ID | VARIANT | SIFRANT | VALUE 1 | 3 | 5 | 50 2 | 3 | 6 | 49 3 | 3 | 1 | 68
I'd like the output to be
VARIANT | VALUES_5 | VALUES_6 | VALUES_1 3 | 50 | 49 | 68
EDIT: I found the solution using PIVOT, the code goes like this:
select * from ( select variant, VALUE, SIFRANT from example_table ) pivot ( max(VALUE) for SIFRANT in ('1','2','3','4','5','6','7','8','9','10') )