Okay
  Public Ticket #3225772
Filter SQL
Closed

Comments

  • Vauneen Odette Pietersen started the conversation

    (we just asked this question on Code Canyon but I think this might be a better platform to ask on)

    Is there any way to change the select relationship for filters from an ‘and’ relationship to an ‘or’ relationship. In other words, if one selected 3 items in the filter, can one return all rows that meet any of the 3 seleted items as opposed to all of the selected criteria?

    So a SQL select statement with something like ' WHERE category = 2 OR species = 7 '

    I hope this makes sense,
    thanks,
    Vauneen

  •  1,850
    Miloš replied

    Hi, Vauneen 

    Thanks for reaching out to us

    -

    Our logic is based on a PHP SQL parser which has full support for the SQL dialect for the following statement types

    SELECT, INSERT, UPDATE, DELETE, REPLACE, RENAME, SHOW, SET, DROP, CREATE INDEX, CREATE TABLE, EXPLAIN and DESCRIBE.

    Some of them are disabled for security reasons.

    Filtering, sorting, and search may not work properly if you include:

    • Accent graves ( ` ) around the table name
    • JOIN functions
    • UNION functions
    • CONCAT functions
    • sub-queries

    -

    If you can get an SQL Query to pull the data as you need it in your database, with your Database Management Tool, ( such as PHPMyAdmin),

    then you can make a MySQL view (which will return the data that you need in your database),

     call it e.g. “view1” and then build a wpDataTables based on a simple query like "SELECT * FROM view1″.

     If you need help with that, you can see our video, where we show an example of using View in our plugin.

    Let me know If that helped.

    Thank yousmile.png


    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    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

  • Vauneen Odette Pietersen replied

    Thank you so much Miloš
    This is very helpful,

    Vauneen

  •   Miloš replied privately