【发布时间】:2016-10-29 14:14:22
【问题描述】:
select * from `a2_posts` where `reply_to` = -1 order by `updated_at` desc offset 4;
我收到了这条消息:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'offset 4' at line 1
我不是 sql 专家,但我真的无法弄清楚 offset 有什么问题。
顺便说一句,这个查询是由 Eloquent ORM 从以下代码生成的:
Post::whereReplyTo($request->input('reply_to'))
->orderBy('updated_at', 'desc')
->offset(Config::PAGE_SIZE * Config::MAX_PAGES)
->get();
我刚刚将生成的查询打入 PHPMyAdmin 以检查发生了什么,这就是我所拥有的
你们知道怎么回事吗? PHPMyAdmin 荧光笔甚至没有突出显示 offset 关键字。
提前致谢
【问题讨论】:
标签: mysql sql laravel orm eloquent