mysql:如何将行数据放入一个返回列

时间:2012-09-12 06:16:00

标签: mysql sql

我不确定如何提出这个问题或者搜索/ google的正确“关键字”是什么。 我在这里有什么

=========================
=   ID   =   Running#   =
=========================
=   A    =      3       =
=   A    =      4       =
=   A    =      5       =
=   E    =      6       =
=   E    =      3       =
=   G    =      4       =
=   G    =      7       =
=   T    =      3       =
=========================

我希望获得回报 A,E,T在一个字符串中,它们运行#3

由于

1 个答案:

答案 0 :(得分:5)

您需要使用 GROUP_CONCAT

SELECT GROUP_CONCAT(ID)
FROM tablename
Where Running = 3