How change this sql in doctrine. Group by with ROLLUP
modifier isn't supported by doctrine.
如何在学说中改变这个sql。 doctrine不支持使用ROLLUP修饰符分组。
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
1 个解决方案
#1
0
It seems you are out of luck:
看来你运气不好:
Because
WITH ROLLUP
is aGROUP BY
modifier, it cannot be solved with a custom function. You'll have to use native SQL for this.因为WITH ROLLUP是GROUP BY修饰符,所以无法使用自定义函数解决它。您必须为此使用本机SQL。
as Jasper N. Brouwer pointed out on a doctrine user group.
正如Jasper N. Brouwer在一个学说用户组中指出的那样。
#1
0
It seems you are out of luck:
看来你运气不好:
Because
WITH ROLLUP
is aGROUP BY
modifier, it cannot be solved with a custom function. You'll have to use native SQL for this.因为WITH ROLLUP是GROUP BY修饰符,所以无法使用自定义函数解决它。您必须为此使用本机SQL。
as Jasper N. Brouwer pointed out on a doctrine user group.
正如Jasper N. Brouwer在一个学说用户组中指出的那样。