SQL LIMIT 和 OFFSET 参数的位置是相反的。

2019-06-23  本文已影响0人  HappyJoo

LIMIT A,B就是 LIMIT B OFFSET A,就是前后参数颠倒一下。

select distinct salary from employee
      order by salary desc limit P,1
# 上面等同于下面
select distinct salary from employee
      order by salary desc limit 1 offset P

虽然我也不知道为什么,但是就是这样的,我看了好久的资料。。

这个教程挺好的(英文)

上一篇 下一篇

猜你喜欢

热点阅读