Building this query and works perfectly fine in MySQL sandbox:
SELECT r.`p1_timestamp`, `p1_meterreading_in_1`, `p1_meterreading_in_2`, `p1_meterreading_out_1` , `p1_meterreading_out_2`, `p1_channel_1_meterreading`, `p1_channel_2_meterreading` FROM p1_log AS r JOIN (SELECT MAX(t.p1_timestamp) AS p1_timestamp FROM p1_log AS t GROUP BY YEAR(t.p1_timestamp), MONTH(t.p1_timestamp)) AS x USING (p1_timestamp) ORDER BY p1_timestamp ASC
Building wpDataTable give following error:
cannot calculate position of within p1_log AS r JOIN (SELECT MAX(t.p1_timestamp) AS p1_timestamp FROM p1_log AS t GROUP BY YEAR(t.p1_timestamp), MONTH(t.p1_timestamp)) AS x USING (p1_timestamp) ORDER BY p1_timestamp ASC
If your MySQL-query based wpDataTable doesn’t work correctly with server-side processing, probably this is happening because wpDataTables server has problems with parsing of the query and building new queries dynamically (happens rarely, but does sometimes). To avoid this if your query is working in phpmyadmin or other tool that you use, please prepare a MySQL view (a stored query), which will return the data that you need, call it e.g. “view1” and then build a wpDataTabled based on a simple query like “SELECT * FROM view1″.
Building this query and works perfectly fine in MySQL sandbox:
SELECT r.`p1_timestamp`, `p1_meterreading_in_1`, `p1_meterreading_in_2`, `p1_meterreading_out_1` , `p1_meterreading_out_2`, `p1_channel_1_meterreading`, `p1_channel_2_meterreading` FROM p1_log AS r JOIN (SELECT MAX(t.p1_timestamp) AS p1_timestamp FROM p1_log AS t GROUP BY YEAR(t.p1_timestamp), MONTH(t.p1_timestamp)) AS x USING (p1_timestamp) ORDER BY p1_timestamp ASC
Building wpDataTable give following error:
cannot calculate position of within p1_log AS r JOIN (SELECT MAX(t.p1_timestamp) AS p1_timestamp FROM p1_log AS t GROUP BY YEAR(t.p1_timestamp), MONTH(t.p1_timestamp)) AS x USING (p1_timestamp) ORDER BY p1_timestamp ASC
Just want to understand what is going wrong.
HI harry440,
Thank you for your purchase.
If your MySQL-query based wpDataTable doesn’t work correctly with server-side processing, probably this is happening because wpDataTables server has problems with parsing of the query and building new queries dynamically (happens rarely, but does sometimes). To avoid this if your query is working in phpmyadmin or other tool that you use, please prepare a MySQL view (a stored query), which will return the data that you need, call it e.g. “view1” and then build a wpDataTabled based on a simple query like “SELECT * FROM view1″.
Kind Regards,
Isidora Markovic
wpDataTables: FAQ | Facebook | Twitter | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Amelia demo sites | Docs
You can try our wpDataTables add-ons before purchase on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables