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 Name Type 1 Adam A 2 Sam B 3 James A 4 Dave C 5 Vick C
我想让它们在PHP中变成这样的数组格式:
people['A'] == {Adam, James} people['B'] == {Sam} people['C'] == {Dave, Vick}
如何操作 GROUP BY 函数?
这是你想要的地方group_concat():
group_concat()
select type, group_concat(name) from t group by type