日期:2014-05-17  浏览次数:20565 次

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