• Hi, In mysql db I’ve got
    form_id | element_label | element_value
    7 | 10 | value 1
    7 | 10 | value 2

    How to create front-end table where column is with mix of form_id = 7 and element_label = 10 and value 1 or 2 are rows?

    img link

    • This topic was modified 5 years, 9 months ago by kikithecat.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi @kikithecat,

    Welcome to the forum! 🙂

    You first need to write a pivot query that gives you the desired result. After that you can write a view for that query. Finally, you can use the view to show your data.

    You can use a view to show your rows in a publication or a project just like a table. The plugin however, does not support updating view. If you want enable update functionality, you can add dynamic hyperlinks to your view. Dynamic hyperlinks are described here:
    https://wpdataaccess.com/docs/documentation/data-explorer/table-settings/

    Here is an example of a pivot query (see Raymond Nijland):
    https://dba.stackexchange.com/questions/164711/how-to-pivot-rows-into-columns-mysql/164794

    Does this help?

    Best regards,
    Peter

    Thread Starter kikithecat

    (@kikithecat)

    Dear Peter, thank you very much for this quick answer. Just to check if I understand well few more things.

    1. Write a pivot query – Create query using, for example, PhpMyAdmin
    2. View for that query – Create View it into PhpMyAdmin and than using that View as a source of data for WP Data Access
    3. show your data – shortcode in post or page

    Is this correct?

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi @kikithecat,

    Yes, that is correct! I’m leaving for a holiday, otherwise I would like to help you solve this issue. I’ll be back on August 17. Let me knowiyf you still nee help after my holiday…

    Good luck! 🙂

    Best regards,
    Peter

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Create table when column name is row in mysql’ is closed to new replies.