tags:

views:

57

answers:

1

can you make pivot/unpivot in mysql similar to ms sql server?

thanks

Here's a link to how SQL Pivot works: link text

A: 

There is no support for PIVOT. Instead you can use a JOIN. For example:

SELECT Table1.Value AS AValue, Table2.Value AS BValue
FROM Table1
JOIN Table2 ON Table1.grp = Table2.grp AND Table2.Type = 'B'
WHERE Table1.Type = 'A'
Mark Byers