For example, I have a table 'Map':
Map: id | place __________ 1 | a 1 | b 2 | a 2 | b 2 | c
What MySQL query can I use for me to have the following results:
id | place __开发者_C百科________ 1 | a,b 2 | a,b,c
You should use the group_concat() function for this. You can use it as follows.
SELECT id,group_concat(DISTINCT place ORDER BY place ASC SEPARATOR ',') 
FROM Map
GROUP BY ID
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论