Reputation: 938
I have a table like this:
name----address----type----value
a finland color 120
a finland wage 500
what i want is to show color
and wage
values as columns:
name----address----color----wage
a finland 120 500
Upvotes: 2
Views: 179
Reputation: 3084
SELECT *
FROM (SELECT name, address, type, value
FROM table)
PIVOT (SUM(value) FOR (type) IN ('color', 'wage'));
Upvotes: 3