I am new to mysql and need help for transposing rows to columns in mysql database I have gone through some examples of transpose but slightly confused in using right syntax and some existing answers add additional requirements which make it slighly different
my exiting table is and rows are more than below shared fews rows for explanation
+----------+-----------+--------+----------+-----------+--------+
| Item | YEAR | Sales | Profit | TSV | REC |
+----------+-----------+--------+----------+-----------+--------+
| machine | 2011 | 10| 10 | 20 | 10 |
| machine | 2010 | 8 | 15 | 6 | 2 |
| machine | 2013 | 15| 5 | 11 | 5 |
| machine | 2009 | 3 | 8 | 9 | 13 |
| machine | 2012 | 6 | 12 | 18 | 16 |
| decors | 2010 | 11| 10 | 13 | 22 |
| decors | 2011 | 9 | 9 | 16 | 12 |
| decors | 2012 | 3 | 7 | 11 | 9 |
| decors | 2013 | 13| 23 | 9 | 10 |
| decors | 2009 | 4 | 9 | 10 | 8 |
| sp parts | 2009 | 22| 25 | 17 | 22 |
| sp parts | 2010 | 21| 22 | 11 | 14 |
| sp parts | 2011 | 28| 30 | 29 | 23 |
| sp parts | 2012 | 23| 28 | 12 | 8 |
| sp parts | 2013 | 21| 24 | 24 | 32 |
-----------------------------------------------------------------
and expected table after transpose is
------------------------------------------------------------------------------------------------------------------------------------------
| Item machine machine machine machine machine decors decors decors decors decors sp parts sp parts sp parts sp parts sp parts |
-----------------------------------------------------------------------------------------------------------------------------------------|
| YEAR 2011 2010 2013 2009 2012 2010 2011 2012 2013 2009 2009 2010 2011 2012 2013 |
| Sales 10 8 15 3 6 11 9 3 13 4 22 21 28 23 21 |
| Profit 10 15 5 8 12 10 9 7 23 9 25 22 30 28 24 |
| TSV 20 6 11 9 18 13 16 11 9 10 17 11 29 12 24 |
| REC 10 2 5 13 16 22 12 9 10 8 22 14 23 8 32 |
------------------------------------------------------------------------------------------------------------------------------------------
can someone help with this question