i have sql table with data as given below
emp id empname dept
------- ---- ------
1 a Hr
2 b Hr
3 c Tech
4 d Hr
5 e Admin
7 f Tech
8 g Admin
Now i want to pivot the above table get the result like this
Hr Tech Admin
----- ----- -----
Empname a c e
Empname b f g
Empname d
I am just wondering is this even possible using pivoting in sql or there is any other mean to achieve this