且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MySQL LIMIT是在ORDER BY之前还是之后应用的?

更新时间:2023-12-03 17:45:34

是的,它在ORDER BY之后.对于您的查询,您将获得记录的publishedOn最高的记录,因为您要订购DESC,从而使结果集中的最大值最大,然后从中选择第一个.

Yes, it's after the ORDER BY. For your query, you'd get the record with the highest publishedOn, since you're ordering DESC, making the largest value first in the result set, of which you pick out the first one.