I have a table with student-name and student-city only. This table is used to find out which student has enrolled online-course from which city.
Table - StudentCity
Mumbai Pune Delhi Kolkata
I take my comment back. You can do this instead :
SELECT CASE City WHEN 'Mumbai' THEN Name END AS Mumbai, CASE City WHEN 'Pune' THEN Name END AS Pune, CASE City WHEN 'Delhi' THEN Name END AS Delhi, CASE City WHEN 'Kolkata' THEN Name END AS Kolkata FROM tab
You can see this in action here -> http://rextester.com/NYZH51845
Hope this help!!!