Quantcast
Channel: Oracle, MySQL, Sybase, Informix and other databases
Viewing all articles
Browse latest Browse all 1350

[MySQL] two tables from rows to colums

$
0
0

Hello there, I need your appreciated help.

I've this mysql table:

+-----------+--------+----------+----------+----------+----------+
| CODE      | RIF    | JAN-12   | FEB-12   | MAR-12   | ABR-12   |+-----------+--------+----------+----------+----------+----------+
| 873368047 | 201301 | 1825.90  | 2045.00  | 1768.60  | 1401.00  |
| 806291447 | 201301 | 17244.20 | 16898.80 | 18635.40 | 26096.40 |
| 872869841 | 201301 | 12728.00 | 10069.20 | 10001.80 | 12293.00 |
| 805700858 | 201301 | 4364.20  | 6162.50  | 6761.60  | 7035.70  |
| 872054391 | 201301 | 23642.00 | 23190.20 | 25060.20 | 32965.20 |+-----------+--------+----------+----------+----------+----------+
5 rows in set

I need transport this dates in other table but in this output:

+-----------+------------+---------+
| CODE      | Month      | number  |
+-----------+------------+---------+
| 873368047 | JAN-12     | 1825.90 |
| 873368047 | FEB-12     | 2045.00 |
| 873368047 | MAR-12     | 1768.60 |
| 873368047 | ABR-12     | 1401.00 |
+-----------+------------+---------+

It's possible?
Can you help me?
Thanks in advance.




Viewing all articles
Browse latest Browse all 1350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>