# 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 | |

priority | normal |
---|---|

type | bug |

done in | 3.12.6 |

load | 0.100 |

load left | 0.000 |

closed by | #5115daeeb2ff [rql2sql] closes #1697862: ORDERBY SUM(C) cancel GROUPBY by wrongly adding C to grouped variables |

similar entities

- cubicweb #246942 supporting aggregates in SET queries
- cubicweb #1947456 ORM should not try to re-fetch initiator relation/entity
- cubicweb #509109 transitivity of relationships
- cubicweb #1922945 conditional log of rql queries
- cubicweb #1381497 support substitution of list of elements passed to RQL IN predicate

[see all]