By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
with t1 as
(
select 1 as Room, 'A' as BLOK, 12 as DATA
union all
select 2,'A',13
union all
select 1,'B',14
union all
select 3,'B',15
)
select room,pv.* from
t1
pivot(max(DATA) for BLOK in ([A],[B])) pv
room | Room | A | B |
---|---|---|---|
1 | 1 | 12 | 14 |
2 | 2 | 13 | null |
3 | 3 | null | 15 |