gpt4 book ai didi

mysql - 如何在 Doctrine 中使用汇总修饰符进行分组?

转载 作者:行者123 更新时间:2023-11-30 22:26:29 24 4
gpt4 key购买 nike

如何在 Doctrine 中改变这个sql。分组依据 ROLLUP modifier不受 Doctrine 支持。

SELECT `users`.`username`,`owner`.`name`,`property`.`name`,SUM(`expenses`.`price`)
FROM `users`
INNER JOIN `owner`ON `users`.`id`=`owner`.`user_id`
INNER JOIN `property`ON `owner`.`id`=`property`.`owner_id`
LEFT JOIN `expenses`ON `property`.`id`=`expenses`.`property_id`
GROUP BY `property`.`id`,`expenses`.`id`with rollup

最佳答案

看来你运气不好:

Because WITH ROLLUP is a GROUP BY modifier, it cannot be solved with a custom function. You'll have to use native SQL for this.

正如 Jasper N. Brouwer 在 doctrine user group 上指出的那样.

关于mysql - 如何在 Doctrine 中使用汇总修饰符进行分组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35087321/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com