Sum and Group By in server action

I have this query:

but I don’t show SUM

Why ? @Teodor

I want show SUM of “Codice Articolo”

Please provide a link to your page.

https://erp.decoresin.com/app/test/test-classifica-prodotti-a-quantita.php

this is a test page

Please add an alias for the SUM column and use it in the table generator then :slight_smile:

1 Like

ok, it works
but it doesn’t order DESC

Sorting is not working because the column you need to sort by is totale_articolo.
Which is not accessible here in query builder.

Remove the sorting condition from query builder, and just add the column alias name in Server Connect’s sort property as below:
image

ok, I did as you say but does not work

I did the same and it worked for me.
See here: http://wappler.slashash.co/test/sortalias.php

Can you share a link of your page?

https://erp.decoresin.com/app/test/test-classifica-prodotti-a-quantita.php

Two observations:

  1. There is no KEY set for the repeat expression.
  2. totale_articolo is returned as numeric, whereas in my test url, the SUM column sumal is being returned as a string. Don’t exactly know why - probably has something to do with MySQL version.
    You can see this too in the Network tab response JSON of Chrome’s dev tools.
    My DB has this column as int(11). And prepared statements in my DB connection is TRUE. MariaDB 10.2.21.