Score:1

How to add groupBy option WITH ROLLUP

so flag

With Drupal 9.5.3, a group by like this:

$query->groupBy("myfieldname WITH ROLLUP");

will result in

(...) Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'myfieldnameWITHROLLUP' (...)

... since spaces are stripped.

Is there any other proper way to add the "WITH ROLLUP"?

No Sssweat avatar
ua flag
Looks like currently it's not possible using Drupal's dynamic query API. See [Support ROLLUP modifier for GROUP BY](https://www.drupal.org/project/drupal/issues/1647884). I would try using a [static query](https://www.drupal.org/docs/drupal-apis/database-api/static-queries) as a workaround.
MSNOP avatar
so flag
Thanks @NoSssweat, that's what I've done for now.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.