Hello, I use the following SQL-statement to retrieve my data :
SELECT reizentbl.PK_Reizen, reizentbl.Reis, reizentbl.AfreisDatum, reizentbl.TerugReis, reizentbl.TypeReis_ID, reizentbl.AantalBegeleiders, reizentbl.Paspoort, reizentbl.Opmerking, reizentbl.Aantal, reizentbl.PO, Sum(temptbl.Bevestigd) AS SomVanBevestigd FROM reizentbl INNER JOIN temptbl ON reizentbl.PK_Reizen = temptbl.Reis_ID WHERE ((DATE(reizentbl.TerugReis) >= SUBDATE(CURDATE(), 0)) AND reizentbl.Reis NOT LIKE \’%Logistiek%\’) GROUP BY reizentbl.Reis, reizentbl.AfreisDatum, reizentbl.TerugReis\”;
As you can see I use the SUM functions in my SQL-statement. Initially my grid is sorted on the \”reizentbl.AfreisDatum\”.
After I load my grid it would be very useful sometimes to filter or sort my grid data so I could see the data where my SUM value is ZERO and still sorted on \”reizentbl.AfreisDatum\”
In my grid : I have tried the sort function on the SUM field but then my sort on \”reizentbl.AfreisDatum\” disappears.
I have tried the filter function on the SUM field but then I receive an SQL-error on the SUM field. How can I solve this problem? Kind regards Willy
You can enable multisort option. e.g.
$opt[“multiSort”] = true;
//…
$g->set_options($opt);
After that, clicking of column will have 3 states. ASC, DESC, NONE.
You can sort one column as ASC and then click of second column to make it ASC/DESC as well.