We're Moving to a New Support Platform – Starting June 1st!
We’re excited to let you know that starting June 1st, we’ll be transitioning to a new support system that will be available directly on our product websites – Amelia, wpDataTables, and Report Builder. In fact, the new support platform is already live for Amelia and wpDataTables, and we encourage you to reach out to us there.
You'll always be able to reach us through a widget in the bottom right corner of each website, where you can ask questions, report issues, or simply get assistance.
While we still do not offer live support, a new advanced, AI-powered assistant, trained on our documentation, use cases, and real conversations with our team, is there to help with basic to intermediate questions in no time.
We're doing our best to make this transition smooth and hassle-free. After June 1st, this current support website will redirect you to the new "Contact Us" pages on our product sites.
Thanks for your continued support and trust – we’re excited to bring you an even better support experience!
Hi,
The following query runs fine in MySQL but I am getting an error when entering it in WpDataTables.
---
SELECT a.ID, r.post_title, a.post_title, a.guid, r.post_type, a.post_type, r.post_author
FROM (SELECT * FROM `wppm_2_posts` WHERE post_author = %CURRENT_USER_LOGIN% AND post_type = 'reviews' AND post_status = 'publish') as r
RIGHT JOIN `wppm_2_posts`as a
ON r.post_title = a.ID
WHERE a.post_type = 'applicants'
AND a.post_status = 'publish'
---
I am getting the following error:
ERROR: cannot calculate position of as a within ) as r RIGHT JOIN `wppm_2_posts`as a ON r.post_title = a.ID WHERE a.post_type = 'applicants' AND a.post_status = 'publish'
I've seen a couple other support tickets where the solution is to create a view, however, because I'm pulling the current user's login ID, I don't think that I can use a view.
Am I missing something or is there a workaround that I can use to accomplish what I need?
Thanks!
Hi Jack, Thank you for your purchase.
Sorry for late response.
We are located in Serbia and our working time is from 10:00 to 17:00 CET. business days.
Can you try to insert quotes in our placeholder?
Can you try with this
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
Hi Milan,
Note: I realized I copied the wrong query before. It should have been %CURRENT_USER_ID% instead of %CURRENT_USER_LOGIN% but still getting an error.
Here is the error I get now:
ERROR: cannot calculate position of as a within ) as r RIGHT JOIN `wppm_2_posts`as a ON r.post_title = a.ID WHERE a.post_type = 'applicants' AND a.post_status = 'publish'
Does WpDataTables support subqueries?
Attached is the query working in MySQL.
Thanks,
Jack
Hello Jack
I'll take over Milan's ticket.
It should work like that. We've had users work with LEFT, RIGHT and INNER JOINs without much issues. That is - the table generated correctly, but search, filtering and sorting may misbehave.
This is probably happening because wpDataTables server has problems with parsing of the query and building new queries dynamically (rarely happens, but does sometimes). To avoid this 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″.
Please note some this when working with the server-side processing feature:
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
The table should be generated correctly as it works in MySQL. As mentioned before, I have a dynamic placeholder and a subquery... both of which wouldn't work with creating a view.
Any idea what the error is saying is the issue?
I am also not suing LIMIT or ORDER BY.
Here is the correct way of writing the query in case anyone finds themselves in a similar situation. This query works with WpDataTables
SELECT
APPLICANTS.ID AS applicants_id
,APPLICANTS.post_title AS applicants_post_title
,APPLICANTS.guid AS applicants_guid
,APPLICANTS.post_type AS applicants_post_type
,REVIEWS.post_author AS reviews_author_id
,REVIEWS.post_type AS reviews_post_type
,REVIEWS.post_title AS reviews_post_title
,R_APP_SCORES.meta_value AS review_app_score
,R_APP_COMMENTS.meta_value AS review_app_comment
FROM
`%WPDB%posts` AS APPLICANTS
LEFT JOIN
`%WPDB%posts` AS REVIEWS ON
(REVIEWS.post_author = %CURRENT_USER_ID%) AND
(REVIEWS.post_title = APPLICANTS.ID) AND
(REVIEWS.post_type = 'reviews') AND
(REVIEWS.post_status = 'publish')
LEFT JOIN
`%WPDB%postmeta` R_APP_SCORES ON
(R_APP_SCORES.post_id = REVIEWS.ID) AND
(R_APP_SCORES.meta_key = 'review_app_score')
LEFT JOIN
`%WPDB%postmeta` R_APP_COMMENTS ON
(R_APP_COMMENTS.post_id = REVIEWS.ID) AND
(R_APP_COMMENTS.meta_key = 'review_app_comment')
WHERE
(APPLICANTS.post_type = 'applicants') AND
(APPLICANTS.post_status = 'publish')
Thank you for sharing the query with everyone, Jack.
If you have any further questions or issues, please feel free to open a new ticket, and we'll gladly help.
Best regards.
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