Have子句中的未知列

时间:2019-05-22 12:58:18

标签: mysql laravel

我在追踪时遇到麻烦 laravel query

Laravel [5.7]引发错误

"message": "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'team_ref_bonus_sum' in 'having clause' (SQL: select count(*) as aggregate from `users` inner join `users__affiliate__structures` as `aff` on `users`.`id` = `aff`.`user_id` left join `users` as `upline` on `users`.`upline_id` = `upline`.`id` group by `users`.`id` having team_ref_bonus_sum IS NOT NULL)"

Same query in sql

SQL查询效果很好

抱歉使用图片,但是stackoverflow迫使我添加更多信息,因为我的帖子主要是代码...

0 个答案:

没有答案