In MySQL we have the ability to create a column that calculates the running total of another column. This is done by setting a variable before SELECT, usually:
SET @Variable := 0;
SELECT
Table. Total........
@Variable := (@Variable + Total)
FROM
-----
It works fine using MySQL Workbench, but not within wpDataTable, which does not allow the SET command
I have tried to use the %VAR1% to set the initial value
PLACEHOLDER TAB: %VAR1% = 0
MySQL Query under SELECT %VAR1% = (%VAR1% + Total) AS CUMT
Surely there must be a way to generate a running total
As per our documentation, using variables ( @ ), stored procedures, and nested queries are not supported, but you can prepare a MySQL view (which will return the data you need); call it “view1” for example, and then build a wpDataTable based on a simple query like “SELECT * FROM view1”.
In MySQL we have the ability to create a column that calculates the running total of another column. This is done by setting a variable before SELECT, usually:
SET @Variable := 0;
SELECT
Table. Total........
@Variable := (@Variable + Total)
FROM
-----
It works fine using MySQL Workbench, but not within wpDataTable, which does not allow the SET command
I have tried to use the %VAR1% to set the initial value
PLACEHOLDER TAB: %VAR1% = 0
MySQL Query under SELECT %VAR1% = (%VAR1% + Total) AS CUMT
Surely there must be a way to generate a running total
Appreciate your assistance
Hello Rocky
As per our documentation, using variables ( @ ), stored procedures, and nested queries are not supported, but you can prepare a MySQL view (which will return the data you need); call it “view1” for example, and then build a wpDataTable based on a simple query like “SELECT * FROM view1”.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables