In an SQL statement, if the field to be sorted is empty, how can this problem be solved ?, If the field to be sorted is empty, the blank field is first by default. Add a DESC keyword to arrange it in reverse order, that is, leave it empty at the end. we recommend that you post: createtable ....... insertintotable ....... sort by mysql fields
In an SQL statement, if the field to be sorted is empty, how can this problem be solved?
------ Solution --------------------
If the field to be sorted is empty, the blank field is first by default. Add a DESC keyword to arrange it in reverse order, that is, the empty keyword at the end.
------ Solution --------------------
We recommend that you post:
Create table .......
Insert into table .......
And expected results.
------ Solution --------------------
ORDER by isnull ('field to be sorted by value ')
You can leave the blank column behind. do you mean this?
------ Solution --------------------
(... WHERE field name is not null group by field name)
UNION (... WHERE field name is null)
......
------ Solution --------------------
... Order by sorting field = ''or sorting Field id null, sorting field
------ Solution --------------------
Why is the field empty? try to leave it blank when creating a table.
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