Reputation: 219
I am trying to figure out how to transpose data from last two column in SQL table from this layout:
into lay out where im going to have one line with last two column to be "fw" and "bw" with counts values underneath as on the layout below:
I understand that i have to use Pivot and i have been trying to follow few tutorials and few post here on stack-overflow but i cant seem to make it work. Any hint or help would be much appreciated.
Upvotes: 1
Views: 34
Reputation: 37473
You can try below
select * from tablename
pivot
(
sum(counts) for label in ([fw],[bw])
) as pv
Upvotes: 2