• Resolved kenneth0426

    (@kenneth0426)


    Hi,

    I have Table A and Table B.
    Table A has 2 columns, i.e. invoice_number, and company_name.

    Table B has 3 columns, i.e. company_name, contact_person, and email_address.

    I hope to combine these 2 Tables via “company_name”. As a result, I can view the Table with 4 columns, i.e. invoice_number, company_name, contact_person, and email_address.

    I tried to use the lookup function. However, it only can replace company_name with other fields, but not append to the original table.

    Can you give me some advices? Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Kim L

    (@kimmyx)

    Hi @kenneth0426,

    It looks like you’re trying to JOIN table A and table B.

    You can create a view for your combined table by executing a JOIN query in the Query Builder.

    A tutorial on how to do a JOIN here: SQL JOIN (With Examples) (programiz.com)

    More information about the Query Builder here: Getting Started | WP Data Access

    Hope that helps! Let us know if you have more questions. 🙂

    Thread Starter kenneth0426

    (@kenneth0426)

    Hi @kimmyx

    Thank you for your reply.

    You’re correct. I finally obtain the desired table by using JOIN query. Do you think I can use your plugin to display that table in frontend?

    Thanks!

    Leeberty

    (@aaronvincentlee)

    Hi @kenneth0426 ,

    Thanks for getting back!

    Yes. You can use WPDA to display a view in the front end via a Data Table.

    You’ll just have to enter the view name on the Table/View name under Publication Data in the Data Tables settings.

    I created a short video for your reference. Please watch: https://share.getcloudapp.com/bLuZkg1e

    I hope this helps!

    Let me know if you have questions.

    Thread Starter kenneth0426

    (@kenneth0426)

    Awesome! The video is great! It is very helpful.

    I think this is a solved topic.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to add fields to a single table?’ is closed to new replies.