Okay
  Public Ticket #2319215
SQL query available on manual table
Closed

Comments

  • Emiel Lelieveld started the conversation

    Dear,

    Just testing the Wptable on your demo site.

    I was making a manual table and then wanted to use a SQL query to filter, but I do not get the SQL window, this window only shows when I select a SQL tabel.

    Any how, I would like to create a or multiple tables (manual or SQL)  to show conference room usage. I like to have a display (page) to show only the table Monday on a Monday etc. So I make 5 tables for each day of the week or I add a column with the day of the week and use that in my filter. Can this be done , or perhaps you can suggest a better way.

    I was thinking to use SQL to compare current day with day in the table ?


     

  •  2,572
    Aleksandar replied

    Hello Emiel

    Thank you for your interest in our plugin.

    When you create a manual table, it is saved in the database in format: wp_wpdatatable_#, where "#" represents the table's ID in the database. You can see this ID when you go to the "Editing" tab above the table, and enable editing.

    Then, you can do what you want with it through SQL Query based tables. You can pull the data into new wpDataTables like:

    SELECT * FROM wp_wpdatatable_3

    Or like:

    SELECT column1, column2, column5 from wp_wpdatatable_3
    WHERE columnID = %CURRENT_USER_ID%

    if you wish to show the data of the table associated only to the currently logged in user.

    Following the same logic, you can create 5 different tables for 5 days of the week:

    SELECT column1, column3, column5 FROM wp_wpdatatable_3
    WHERE column1 = 'Monday'

    Unfortunately, using curdate() or anything similar goes for the date, not the day.

    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