-
using column name as row value
i all,
I have a requirement and unable to solve this problem. I want ur urgent help. The problem is that there is a table like this
Allowance1 Allowance2 Allowance3 empid
12 13 14 56
15 45 89 89
78 102 89 20
I want to change this as
empid allowance amount
56 allowance1 12
56 allowance2 13
56 allowance3 14
89 allowance1 15
89 allowance2 45
89 allowance3 89
Like this one I want as outcome
Please help me in getting this output
-
select empid, 'allowance1',allowance1
union
select empid, 'allowance2',allowance2
union
select empid, 'allowance3',allowance3
from table
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|