mysql排序有关问题
程序员文章站
2022-04-06 23:16:52
...
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` ) , ' ' ),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相关文章
相关视频
上一篇: php 面向对象基础