日期:2014-05-16  浏览次数:20789 次

查找复合索引的字段按顺序输出
查找复合索引的字段:
select GROUP_CONCAT(column_name) as composit_index
from information_schema.statistics
where table_name='fruits'
group by index_name
having count(index_name)>1

对于每组的复合索引字段,我想按照seq_in_index进行排序输出
如何操作?



------解决方案--------------------
SQL code
select GROUP_CONCAT( column_name ORDER BY  SEQ_IN_INDEX desc) as composit_index
from information_schema.statistics
where table_name='test1'
group by index_name
having count(index_name)>1