--场景1: select pt, greatest(wm), least(wm) from (select s.producttype pt, wm_concat(s.productid) wm from sys_product s group by s.producttype) ; /* --结果: 1 | 1 17,19,16,15,9,4,3,2,1,14,13,18 2 | 2 5,12,11,10,8,7,6 --maxt=17,19,16,15,9,4,3,2,1,14,13,18…