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!

Okay
  Public Ticket #2685280
MYSQL Query Failing
Closed

Comments

  • Alex started the conversation

    I am attempting to create a wpDataTable using a typical SQL command.  I have WP datatables linked to my MYSQL database table, and I am interested in getting the most recent 5 entries in a table.  In my database I use the following SQL command to do this:

    SELECT * FROM `Motorx1` ORDER BY `Motorx1`.`id` DESC LIMIT 5

    However, this is not working when I try to use this query to create a table in WPdatatable.  I can use:

    SELECT * FROM `Motorx1` ORDER BY `Motorx1`.`id`

    but this gets me all of the entries in the table and I am not interested in this.

  •  2,576
    Aleksandar replied

    Hello Alex

    Thank you for your purchase.

    Please note some this when working with the server-side processing feature:

    • Please do not use “LIMIT” in the SELECT statement. wpDataTables adds it automatically and it will be overridden.
    • Please do not use “ORDER BY” in the SELECT statement. wpDataTables has its own sorting engine, so it makes no sense to use MySQL’s sorting, since it will be overridden. Also, server-side processing feature adds this part of the statement automatically when users trigger the sorting on the front-end, and having it in the initial statement may cause the table to crash.

    You can use this query:

    SELECT * FROM Motorx1 ORDER BY id DESC LIMIT 5
    

    if you disable "server-side processing" on the "Data Source" tab above the table:

    7042314750.png


    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia 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