MySQL之group_concat 配合substring_index查询

字符串链接:group_concat([DISTINCT] 要链接的字段 [Order BY ASC/DESC 排序字段] [Separator '分隔符'])spa

字符串截取:substring_index(str,delim,count)排序

例如查询每一个用户的最大投资额:字符串

select investoruserid,substring_index(group_concat(investamount order by investamount desc separator ','),',',1) from loan_investor group by investoruserid; string

相关文章
相关标签/搜索