Rumah >pembangunan bahagian belakang >tutorial php > mysql排序有关问题
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` ) , ' ' )这个统计出来的字段排序,请问应该怎么做呢??
------解决方案--------------------
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 <div class="clear"> </div>