摘要:
直接看例子例子: table id name 1 a 2 b 3 c 4 c 5 b1 通过 distinct 来实现select distinct name from table结果:nameabc2 通过 group_concat 配合 group by 来实现 (注意:需要mysql 4.1及以上)select id,group_concat(distinct name) from table group by name结果:id name1 a2 b3 c3 通过select id, count(distinct name) from table group by name结果:id. 阅读全文