当我手动运行下面的SQL时,我得到的预期结果没有错误
select * from `crawl_results`
where `user_id` = 1 and `website_id` = 1
and `item_state` != 'OK' group by `destination_url`
limit 30 offset 0
但是,当我在Eloquent中运行此命令时...
self::where('user_id', Auth::id())
->where('website_id', $scanID)
->where('item_state', '!=' , 'OK')
->groupby('destination_url')->paginate(30)
它产生此错误:
SQLSTATE [42000]:语法错误或访问冲突:1055'link_checker.crawl_results.id'不在GROUP BY中(SQL:选择* from crawl_resultswhere user_id= 1 and website_id= 1 and item_state!= OK group by destination_urllimit 30 offset 0)
不确定产生该错误的抽象背后发生了什么?
SMILET
斯蒂芬大帝