SELECT *, group_concat (, concat_ws (X, 'sku ', 'quantity-purchased'),), group_concat (, 'Order _ id ',) FROM (select * from 'sale _ orders 'order SQL query sorting problem
SELECT *, group_concat ('', concat_ws ('X', 'sku ', 'quantity-purchased'),''), group_concat ('', 'Order _ id ', '') FROM (select * from 'sale _ orders 'Order by 'sku ') t where 'shippings' = 0 AND 'number' = $ id group by 'reiient-name', 'ship-address-1 'Order BY 'SK'
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, A0042-00-AC-25 X 1, A0256-00-O6-34 X 1
004-04 fang A0041-00-WW-25 X 1, A0042-00-AC-25 X 1, A0217-00-SI-33 X 1
On this basis, how can I sort by the number of sku in the SKU-quantity field (that is, the string length)
------ Solution --------------------
Try... order by count (sku)
------ Solution --------------------
Group_concat ('', concat_ws ('X', 'sku ', 'quantity-purchased'),''), group_concat ('', 'Order _ id ', '')
Two group_concat,
And your results
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
How is it matched?
Which one is shu-quantity?