Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一张像下面这样有价值的桌子预订
id email 1 a@a.com 2 a@a.com 3 b@b.com 4 c@c.com 5. c@c.com
我想要这样的输出
email id a@a.com 1,2 b@b.com 3 c@c.com 4,5
你能建议我怎么做吗?
在MysQL, 使用GROUP_CONCAT函数
MysQL
GROUP_CONCAT
SELECT email, GROUP_CONCAT(id) id FROM tableName GROUP BY email