MySQL:列到行

时间:2017-09-28 16:11:36

标签: mysql database

我有一个问题:我有这样的事情:

这可能是:

SELECT country, profit 
FROM whatever

+---------+--------+
| country | profit |
+---------+--------+
| Finland |   1500 |
| Finland |    100 |
| India   |    150 |
| India   |   1200 |
| USA     |     75 |
| USA     |   1500 |
| Finland |     10 |
| USA     |     50 |
| USA     |   2700 |
| USA     |    250 |
+---------+--------+

我想做这样的事情:

+---------+--------+--------+--------+-------+--------+
| country | profit | profit | profit | profit| profit |
+---------+--------+--------+--------+-------+--------+
| Finland |   1500 |    100 |     10 |       |        |
| India   |    150 |   1200 |        |       |        |
| USA     |     75 |   1500 |     50 |  2700 |    250 |
+---------+--------+--------+--------+-------+--------+

可悲的是,我没有任何想法怎么做...... :(

甚至可能吗? :(

我会很高兴每一个回应这个话题..!请...,帮帮我.. :(

0 个答案:

没有答案