Sum and Group By in server action


#1

I have this query:

but I don’t show SUM

Why ? @Teodor

I want show SUM of “Codice Articolo”


#2

Please provide a link to your page.


#3

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

this is a test page


#4

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


#5

ok, it works
but it doesn’t order DESC


#6

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


#7

ok, I did as you say but does not work


#8

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?


#9

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


#10

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.