This is called pivoting. you can achieve it like thisSELECT MAX(CASE WHEN jobposition = 'Teacher' THEN name END) AS teacher,MAX(CASE WHEN jobposition = 'programmer' THEN name END) AS programmer,MAX(CASE WHEN jobposition = 'welder' THEN name END) AS welder,MAX(CASE WHEN jobposition = 'painter' THEN name END) AS painterFROM Table
Another way is to PIVOTSELECT *FROM Table tPIVOT (MAX(name) FOR jobposition IN ([teacher],[programmer],[welder],[painter]))p
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs