Prev: A way to set developer edition to behave like another edition
Next: non latin characters in nvarchar
From: visweswaran28 on 7 Jun 2010 04:15 Hi, I am having a table which contains emp_name, basic_pay, PF, other_info. Now i want to display as, emp_name1 basic_pay emp_name1 PF emp_name1 Other_info Like this, Instead of displaying in single row, i want to display in different row based on that emp_name. How Can I achieve this.
From: Plamen Ratchev on 7 Jun 2010 12:39
You can use unpivot assuming columns are the same data type (if not you have to cast then first in subquery). SELECT emp_name, col, value FROM MYTable AS T UNPIVOT (value FOR col IN (basic_pay, PF, other_info)) AS U; -- Plamen Ratchev http://www.SQLStudio.com |