MySQL选择列组作为一个别名

MySQL选择列组作为一个别名,mysql,select,Mysql,Select,我有一张类似的桌子: 我想要的输出是: 我尝试的是: 我尝试在SELECT语句中使用CONCAT,但这似乎是一种草率的做法 在Player1、Player2等不为空的情况下,是否有更好的方法选择玩家?您正在寻找concat\w: 杰出的非常感谢。 ID | Player1 | Player2 | Player3 | Player4 | Player5 | Player6 | Place ====================================================

我有一张类似的桌子:

我想要的输出是:

我尝试的是:

我尝试在SELECT语句中使用CONCAT,但这似乎是一种草率的做法

在Player1、Player2等不为空的情况下,是否有更好的方法选择玩家?

您正在寻找concat\w:


杰出的非常感谢。
ID    | Player1 | Player2 | Player3 | Player4 | Player5 | Player6 | Place
==============================================================================
1     | Greg    |  NULL   |  Mike   |  NULL   |  NULL   |  NULL   | Rockford
2     | NULL    |  Lisa   |  NULL   |  JEFF   |  NULL   |  NULL   | Peoria 
Place    | Players
=====================
Rockford | Greg, Mike
Peoria   | Lisa, Jeff
select place, concat_ws(',', player1, player2, player3, player4, player5, player6) as players
from your_table;