为什么DESC的订单会失败,而ASC的订单会工作?

时间:2022-10-14 13:43:47

Why would only one of these queries work?

为什么这些查询中只有一个有效呢?

Works:

工作原理:

SELECT *
FROM `global_rank`
WHERE rank_type = 2
  AND rank < 1531.26367188
  AND id <> 103
ORDER BY rank ASC

Fails (ie returns 0 rows):

失败(即返回0行):

SELECT *
FROM `global_rank`
WHERE rank_type = 2
  AND rank < 1531.26367188
  AND id <> 103
ORDER BY rank DESC

2 个解决方案

#1


4  

There is no problem with your sql queries they are flawless.

您的sql查询没有问题,它们是完美无缺的。

Please check the way you are validating your query results. I know sometimes we overlook the results ( common human error).

请检查您验证查询结果的方式。我知道我们有时会忽略结果(常见的人为错误)。

#2


1  

After pondering this for a few hours, I'm almost sure it has to be a corrupted index problem. Drop the index on rank and re-add it to see if the behavior changes.

在考虑了几个小时之后,我几乎可以肯定它一定是一个被破坏的索引问题。删除rank的索引并重新添加它,以查看行为是否发生了变化。

#1


4  

There is no problem with your sql queries they are flawless.

您的sql查询没有问题,它们是完美无缺的。

Please check the way you are validating your query results. I know sometimes we overlook the results ( common human error).

请检查您验证查询结果的方式。我知道我们有时会忽略结果(常见的人为错误)。

#2


1  

After pondering this for a few hours, I'm almost sure it has to be a corrupted index problem. Drop the index on rank and re-add it to see if the behavior changes.

在考虑了几个小时之后,我几乎可以肯定它一定是一个被破坏的索引问题。删除rank的索引并重新添加它,以查看行为是否发生了变化。