Sorting by aggregate columns such as SUM() and COUNT() fails

======== TEMPLATE BUG FORM ========

Wappler Version : 3.0.1
Operating System : Windows 10

Expected behavior

Sorting on an aggregate column should sort correctly

Actual behavior

Sorting by aggregate columns produces the wrong result - the order is incorrect.

How to reproduce

Create a query using Query Builder, including columns using aggregate functions - eg COUNT() or SUM().
Include these columns when creating a table with the table generator, including sort options. Problem: while other, non-aggregate columns sort as expected, aggregate columns appear to sort randomly. It seems an additional column is added to the ORDER BY statement (eg the column used for the COUNT() expression).

This issue was originally raised in this thread which has more examples and details.

Community Page
Last updated: