Okay
  Public Ticket #3184735
Creating Table from MySQL view
Closed

Comments

  • Eileen Arcilla started the conversation

    When I try to select a view in my database, none of the columns show up for me to select when creating a table.

    If I select a table, it does show the fields so I know the connection does work.

    Is the use of views supported?

    If not, I have two tables, with multiple relationships to the same table.  Is there a way to create multiple relationships to the same table (essentially a left join)?

  •  1,850
    Miloš replied

    Hi, Eileen 

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.

    -

    And sorry about copying some additional notes on top of the ticket.

    You probably got an Email with that version of the reply - i have edited the reply here with only the relevant details.

    1. If you wish to use a prepared MySQL view in our plugin,

    which will return the data that you need, calling it for example “view1” ,

     then you would build an SQL based wpDataTable 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.

    -

    So, basically, we can not select the View from the "MySQL query constructor" but you can to use it directly as part of an SQL Query in a table.

    Let me know If that helped.

    -

    2.

    Alternatively, you can also use JOINs directly in our SQL tables, we just have to point out some limitations.

    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

    3.

    You can also try our built-in Foreign Key feature.

    -

    Let me know if these information help, and if you have any questionssmile.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