当前位置:Gxlcms > PHP教程 > mysql排序有关问题

mysql排序有关问题

时间:2021-07-01 10:21:17 帮助过:10人阅读

mysql排序问题
SELECT * , group_concat( ' ' , concat_ws( ' X ', `sku` , `quantity-purchased` ) , ' ' ),group_concat(' ' , `order_id` , ' ') FROM `sale_orders` WHERE `shipments` =0 AND `number` =1 GROUP BY group_concat( ' ' , concat_ws( ' X ', `sku` , `quantity-purchased` ) , ' ' )



我想要按照group_concat( ' ' , concat_ws( ' X ', `sku` , `quantity-purchased` ) , ' ' )这个统计出来的字段排序,请问应该怎么做呢??

------解决方案--------------------
SQL code
SELECT * , group_concat( ' ' , concat_ws( ' X ', `sku` , `quantity-purchased` ) , ' ' ) as str ,
group_concat(' ' , `order_id` , ' ') FROM `sale_orders` 
WHERE `shipments` =0 AND `number` =$id 
GROUP BY `recipient-name` , `ship-address-1`  
ORDER BY  str                     

人气教程排行