SQL query and sorting

Source: Internet
Author: User
SELECT *, group_concat ('', concat_ws ('X', 'sku ', 'quantity-purchased'),''), group_concat ('', 'order _ id', '') FROM SQL query sorting
SELECT *, group_concat ('', concat_ws ('X', 'sku ', 'quantity-purchased'),''), group_concat ('', 'Order _ id ', ') FROM 'sale _ orders' WHERE 'shipents' = 0 AND 'number' = $ id group by 'recipient-name ', 'ship-address-1 'Order BY 'sku'

Can group_concat ('', concat_ws ('X', 'sku ', 'quantity-purchased'),'') be sorted ???

The query results are as follows:

Ship name sku-quantity
001-01 wang A0015-00-04-23 X 1
002-02 liu A0041-00-WW-25 X 1, A0042-00-AC-25 X 1
003-03 li A0041-00-WW-25 X 1, A0256-00-O6-34 X 1, A0042-00-AC-25 X 1
004-04 fang A0042-00-AC-25 X 1, A0041-00-WW-25 X 1, A0217-00-SI-33 X 1


The sku-quantity field is sorted by SKU. I want the SKU of each record to be sorted as well.

------ Solution --------------------
FROM 'Sale _ orders'
Change
FROM (select * from 'sale _ orders 'Order by 'sku ') T

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.