+ --------------- + -------------------- + --------- +- -------- +
| idTurnament |名称| TeamA |团队B |
+ --------------- + -------------------- + --------- +- -------- +
| 13 | A VS B | 5 | 6 ||
+ --------------- + -------------------- + --------- +- -------- +


+ --------------- + -------------------- + --------- +
| idTurnament |名称|团队|
+ --------------- + -------------------- + --------- +
| 13 | A VS B | 5 |
| 13 | A VS B | 6 |
+ --------------- + -------------------- + --------- +

最佳答案

您可以使用UNION ALL

select idTurnament, name, TeamA as team
from yourtable
union all
select idTurnament, name, TeamB as team
from yourtable

关于mysql - 如何在SQL中将1row 2字段连接为2行1字段?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43839485/

10-12 02:40