I am trying to split the values โโof one column into several columns based on another column value, I could get it, but I canโt remove the extra null values โโthat I get
Table
create table tbl1 (id int, strtype varchar(50), strvalue varchar(20)); insert into tbl1 values (1, 'name', 'a'),(1, 'value', 'a1'),(1, 'name', 'b'),(1, 'value', 'b1');
Desired Conclusion
NAME VALUE a a1 b b1
sql i tried
select (case when strtype='name' then strvalue end) as name, (case when strtype='value' then strvalue end) as value from tbl1
source share