Bug #90343 Sorting problem
Submitted: 9 Apr 2018 3:02 Modified: 20 Apr 2018 14:37
Reporter: laurel zhu Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version: OS:Windows
Assigned to: CPU Architecture:Any

[9 Apr 2018 3:02] laurel zhu
Description:
sql:SELECT i_dataid,i_datatime FROM dc_data_228_201804 WHERE i_datatime >=1522545186000 AND i_datatime <=1523236388000  ORDER BY i_datatime DESC LIMIT 0,5
result:
i_dataid   i_datatime
19	1522811316000
20	1522811316000
18	1522718330000
17	1522718230000
16	1522718030000

sql:SELECT i_dataid,i_datatime FROM dc_data_228_201804 WHERE i_datatime >=1522545186000 AND i_datatime <=1523236388000  ORDER BY i_datatime DESC
result:
i_dataid   i_datatime
20	1522811316000
19	1522811316000
18	1522718330000
17	1522718230000
16	1522718030000
15	1522717159000

How to repeat:

When sorting, the key word limit is used and the value of sorting is the same.
[20 Apr 2018 14:37] MySQL Verification Team
Hi,

Thank you for your bug report.

Luckily, this is not a bug. You are ordering by the column which has duplicates. In case of the duplicates, no order is guaranteed. That is conforming with SQL standards and is described in our manual. 

If you want always the same order, add the other column to the ORDER BY clause.