Home  >  Article  >  Backend Development  >  mysql排序有关问题

mysql排序有关问题

WBOY
WBOYOriginal
2016-06-13 10:46:28770browse

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<div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn