• Resolved cornertune

    (@cornertune)


    ​I’m trying to do a correlated sub-query that works great in MySQL, but wpdatatables is throughing up an error. Here is the query:

    SELECT count(*) AS TOTAL_SPONSORS,
    (SELECT count(*) FROM table1 as p WHERE NOT EXISTS (SELECT t.sponsor_slug FROM table2 as t where t.sponsor_slug = p.sponsor_slug)) AS EMPTY_TABLES,
    (SELECT count(*) FROM table1 as p WHERE EXISTS (SELECT t.sponsor_slug FROM table2 as t where t.sponsor_slug = p.sponsor_slug)) AS FILLED_TABLES
    FROM table1

    The error is:
    unknown [expr_type] = reserved in “WHERE” [1]​

    This query is valid and work fine in MySQL from the command line or via phpMyAdmin.
    Any thoughts?

Viewing 1 replies (of 1 total)
  • Plugin Author wpDataTables

    (@wpdatatables)

    Hi there, thank you for your inquiry, and sorry for our delay,

    Please for such queries use a MySQL view, and then use “SELECT * FROM viewname” in wpDataTables to make it work.

    Also please note that this is the Lite version’s forum while you’re asking about the full version. Please use the support portal going forward – https://tmsplugins.ticksy.com

    Thanks!

Viewing 1 replies (of 1 total)

The topic ‘MySQL Correlated sub-query’ is closed to new replies.