Is it possible that multiple ORDER BYs will affect the contents of the SELECT result?

Asked 2 years ago, Updated 2 years ago, 48 views

environment
·MySQL 5.7

Question
·ORDER BY is the order of arrangement, so I thought it would not affect the contents of the SELECT result itself even if I specify more than one order, but is it not?
·Not necessarily??

·If I specify one, I can get it as I expected, but

ORDER BY Table a.`Column 1`DESC,  

"·When I specify two things, the contents of the acquired ""a.Column 1"" may be ""0000""…

""
ORDER BY Table a. `Column 1`DESC, Table b. `Column 2`DESC

mysql

2022-09-30 16:23

1 Answers

I have a question close to home.(Is SQL order by claim guaranteed to be stable (by Standards) )

)

ORDER BY sorting results should not be considered stable, so
If the column specified in ORDER BY maintains the order of rows, you should consider the order of appearance (order of rows) of columns that are not specified to be indefinite.

# If the order of alignment is out of order within the specified column range, it is a different issue.As Suzuki commented, I think I need more information.


2022-09-30 16:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.