Okay
  Public Ticket #2467934
New table based off existing table
Closed

Comments

  • Christopher Schroeder started the conversation

    Hi,

    I'm trying to create a new table based on existing table. In this new table I just want to display specific rows and specific columns, not the entire dataset.

    My intended outcome is that I'll only have to update one table and the other will also reflect those updates.

    Is this possible? If so, how? I suspect the second table will have to be a MySQL table. If so, is there a sample query I can use? Or is there a more efficient way to do this?

    Thank you! 

    Chris

  • Christopher Schroeder replied

    Okay - I've found the MySQL query constructor. I've set up the table as I need it and see the preview working as intended. However, when I click create table I get an error page that simply displays a timestamp and nothing else (see attachment) 

  • Christopher Schroeder replied

    Problem still exists but this issue is now Solved via a workaround. I used the MySQL query constructor to create the query via the visual interface. I copied the query then clicked the link to bring me back to the new table wizard. This time I clicked on 'create new table by existing data source' and selected MySQL in the dropdown. On the next screen I pasted the query and created the table. 

  •  2,507
    Aleksandar replied

    Hello Christopher

    Thank you for reaching out to us.

    The query constructor should be treated as a helper, it is not an ultimate query generator. It simply constructs a suggestion of a query. We are constantly working to improve it, but SQL is such a complicated and flexible language that full automation for constructing queries is next to impossible. Consequently, the more complicated the query, the higher is the probability that it will not return exactly what you need. So, you will often need to play around with the resulting query.

    If you have a database table "myTable", and you need to create a new table from it, you can do it like this:

    SELECT  column1,
            column3,
            column5
    FROM myTable
    WHERE column1 = 100 AND column3 = 'test'

    So the new table will be created only displaying columns 1, 3 and 5, with the filtered values where column1 shows only rows that contain "100", and column3 shows only "test".

    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