Hi @yogesh kumar rathi
Please check this sample:
declare @source_table table (id int,[type] varchar(20), val int)
insert into @source_table values(1,'AA',98),(2,'AA',56),(3,'BB',26),(4,'CC',47)
select * into #temp
from @source_table pivot(max(val) for [type] in ([AA],[BB],[CC]))p
select * from #temp
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.