cubicweb #1697862 ORDERBY SUM(C) seems to cancel GROUPBY [resolved]

This request gives me multiple identical results for X in the first column

Any X, SUM(C) GROUPBY X ORDERBY SUM(C) DESC LIMIT 10 WHERE H stats_about X, H count C

Adding DISTINCT doesn't help

DISTINCT Any X, SUM(C) GROUPBY X ORDERBY SUM(C) DESC LIMIT 10 WHERE H stats_about X, H count C

Replacing the "ORDERBY SUM(C)" by "ORDERBY 2" gives me a correct result:

Any X, SUM(C) GROUPBY X ORDERBY 2 DESC LIMIT 10 WHERE H stats_about X, H count C
prioritynormal
typebug
done in3.12.6
load0.100
load left0.000
closed by#5115daeeb2ff [rql2sql] closes #1697862: ORDERBY SUM(C) cancel GROUPBY by wrongly adding C to grouped variables