Statement:
Copy codeThe Code is as follows:
Select * from [User] order by [Password] desc, Id asc
If one condition is repeated, the second condition is used for sorting.
As follows:
Note the 14th and 15th records here.
(Sort by Id when the Password is the same)
Statement:
Copy codeThe Code is as follows:
Select top (5) * from (select top (5) * from [User] order by Id desc) x order by [Password] asc
Sort the queried (sorted) data
(That is, sort the first five records by Id and then sort the five records by Password)
Copy codeThe Code is as follows:
Select top (5) * from [User] order by Id desc
As follows:
Copy codeThe Code is as follows:
Select top (5) * from (select top (5) * from [User] order by Id desc) x order by [Password] asc
As follows:
Make an address book today because the customer's requirements are complicated .......
I have found some materials online for sorting by more conditions.
Copy codeThe Code is as follows:
Select * from Reply where Replyid = "& request (" Replyid ") &" order by sorting Field 1 desc, sorting Field 2 desc, sorting Field 3 desc