MySQL支持实现group_concat() 内部自定义排序:
实例:新建一张表 reward,表中数据如下:
SQL:
SELECT uid, GROUP_CONCAT(money ORDER by money DESC) AS money_desc FROM reward GROUP BY uid DESC;
结果:
使用其他字段也一样的效果:
SQL:
SELECT uid, GROUP_CONCAT(id ORDER by money DESC) AS id_money_desc FROM reward GROUP BY uid DESC;
结果:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)