• + 5 comments

    Simply i wrote this code in SQL Server and its working fine:

    select Doctor,Professor,Singer,Actor from (select Name,Occupation ,row_number() over(partition by Occupation order by Name) rn from Occupations) as source pivot ( max(name) for Occupation in (Doctor,Professor,Singer,Actor) ) as PVT;