56,912
社区成员




mysql> select * from test;
+-----------+
| typenum |
+-----------+
| 1,6,15,12 |
| 1,30,15 |
| 32,2,6 |
| 6,15,11 |
+-----------+
4 rows in set (0.00 sec)
mysql> select n from (
-> select SUBSTRING_INDEX(concat(typenum,',,,,,,,,'),',',1) as n from test
-> union all
-> select SUBSTRING_INDEX(SUBSTRING_INDEX(concat(typenum,',,,,,,,,'),',',2),',',-1) from test
-> union all
-> select SUBSTRING_INDEX(SUBSTRING_INDEX(concat(typenum,',,,,,,,,'),',',3),',',-1) from test
-> union all
-> select SUBSTRING_INDEX(SUBSTRING_INDEX(concat(typenum,',,,,,,,,'),',',4),',',-1) from test
-> ) a
-> Where n!=''
-> Group by n
-> order by Count(*) desc
-> limit 10;
+------+
| n |
+------+
| 6 |
| 15 |
| 1 |
| 12 |
| 30 |
| 2 |
| 32 |
| 11 |
+------+
8 rows in set (0.00 sec)
mysql>