Home Backend Development PHP Tutorial sql查询排序的有关问题

sql查询排序的有关问题

Jun 13, 2016 pm 01:12 PM
concat sku

sql查询排序的问题
SELECT * , group_concat( ' ' , concat_ws( ' X ', `sku` , `quantity-purchased` ) , ' ' ),group_concat(' ' , `order_id` , ' ') FROM `sale_orders` WHERE `shipments` =0 AND `number` =$id GROUP BY `recipient-name` , `ship-address-1` ORDER BY `sku`

请问group_concat( ' ' , concat_ws( ' X ', `sku` , `quantity-purchased` ) , ' ' )所产生的结果能不能排序???

以下为查询的结果:

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  


sku-quantity字段整体是按照SKU来排序的,我是想要每条记录的SKU也能排序。

------解决方案--------------------
FROM `sale_orders`
改为
FROM ( select * from `sale_orders` order by `sku`) T

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Mall SKU inventory management system development guide: Detailed explanation of PHP technology Mall SKU inventory management system development guide: Detailed explanation of PHP technology Sep 12, 2023 pm 03:00 PM

With the rapid development of e-commerce, more and more companies choose to open online malls and sell products online. For a mall, SKU (StockKeepingUnits) is a very important concept. SKU is a specific code defined by merchants to better manage product inventory. It can uniquely identify a product and record the characteristics and attributes of the product. In order to better manage SKU inventory, merchants need to develop a dedicated SKU inventory management system. in the text

Concatenate strings using String.Concat function in C# Concatenate strings using String.Concat function in C# Nov 18, 2023 pm 12:33 PM

Title: Using the String.Concat function in C# to connect strings In C# programming, strings are a common data type, and we often need to concatenate strings. C# provides a variety of ways to concatenate strings, one of the commonly used methods is to use the String.Concat function. This article will introduce how to use the String.Concat function and provide specific code examples. The String.Concat function is a static method used to connect multiple

Douyin releases special announcement on low-priced SKU traffic diversion for merchants Douyin releases special announcement on low-priced SKU traffic diversion for merchants Mar 08, 2024 am 09:43 AM

An inspection on the Douyin platform found that some merchants have violated the rules of attracting users’ clicks through low-priced SKUs, including but not limited to “low-priced SKUs across categories”, “low-priced SKUs across styles”, “single piece/main set” "Mixed selling of parts and accessories," etc., have had a negative impact on the platform's consumer experience and the platform's fair and just business environment. In order to improve consumers' shopping experience, we will continue to optimize the shopping platform environment, continue to review and remove fraudulent products that attract traffic at low prices. For those merchants who maliciously cheat and violate regulations, we will take more severe measures and upgrade their stores. Special rectification plan: For illegal products, the Douyin platform will carry out management and control measures such as product interception, reduction of exposure, and removal and banning; for merchants who still fail to comply after being fined three times or more

How to implement database design for multi-specification SKU of products in PHP How to implement database design for multi-specification SKU of products in PHP Sep 06, 2023 am 09:03 AM

How to implement database design for product multi-specification SKU in PHP In e-commerce platforms, product specifications are a very important concept. Product specifications can be understood as the different attributes and characteristics of the product, such as size, color, weight, etc. In practical applications, for different specifications, we often need to set different prices, inventory, pictures and other information for each combination. This requires us to design a suitable database structure to store and manage product specifications and related information. This article will introduce how to implement multi-specification SKU of products in PHP

IFA 2024 | Core Ultra Series 2: In Lunar Lake, Intel introduces its most efficient x86 CPU yet IFA 2024 | Core Ultra Series 2: In Lunar Lake, Intel introduces its most efficient x86 CPU yet Sep 04, 2024 am 06:38 AM

Roughly one year after announcing the Core Ultra Series 1, also known as Meteor Lake, Intel follows up with the second generation. Core Ultra Series 2 aka Lunar Lake was already introduced at June's Computex. At IFA, the final launch of the Core Ultr

How to use PHP to implement product multi-specification SKU function How to use PHP to implement product multi-specification SKU function Sep 05, 2023 am 08:25 AM

How to use PHP to implement product multi-specification SKU function Product multi-specification SKU is a common product attribute setting on e-commerce platforms. It allows merchants to set different specifications and prices for the same product to meet consumers' different needs and preferences. This article will introduce how to use PHP to implement the multi-specification SKU function of products and provide corresponding code examples. Hope it helps readers in need. 1. Data structure design Before realizing the multi-specification SKU function of products, we need to design the data structure of the database first. Suppose there are three products

How to handle the addition, deletion, modification and query of SKU products in PHP mall development How to handle the addition, deletion, modification and query of SKU products in PHP mall development Sep 11, 2023 pm 02:25 PM

How to handle the addition, deletion, modification and search of SKU products in PHP mall development. With the rapid development of e-commerce, more and more companies choose to sell products online. Among them, SKU (StockKeepingUnit) products are an indispensable part of e-commerce. SKU is a code that uniquely identifies and tracks a product, and contains information such as the product's attributes, specifications, price, etc. In PHP mall development, processing the addition, deletion, modification and search of SKU products is one of the important details. 1. The increase of SKU products in PH

PHP coding practice: how to implement the multi-specification SKU function of products PHP coding practice: how to implement the multi-specification SKU function of products Sep 05, 2023 pm 07:04 PM

PHP coding practice: How to implement the multi-specification SKU function of products In e-commerce websites, the multi-specification SKU (StockKeepingUnit) function of products is a very common requirement. Through multi-specification SKUs, we can easily manage different attributes of goods, such as size, color, capacity, etc., and implement inventory management and price calculation for different attribute combinations. This article will introduce how to use PHP to implement the multi-specification SKU function of products, and come with relevant code examples. 1. Database design First, we need to design the database

See all articles