首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

查寻复合索引的字段按顺序输出

2012-09-14 
查找复合索引的字段按顺序输出查找复合索引的字段:select GROUP_CONCAT(column_name) as composit_indexfr

查找复合索引的字段按顺序输出
查找复合索引的字段:
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_indexfrom information_schema.statisticswhere table_name='test1'group by index_namehaving count(index_name)>1 

热点排行