Best Way to Associate Values Between Two Tables?

Best Way to Associate Values Between Two Tables?

Comments

  • Hey, so I have information from two different tables that I want to be able to associate. I want to pass in one string that resides in the first database table and associate it with a string from the second database table. I was thinking of maybe using a truth table? Not sure if this is the best method since this flow will need to run constantly, and I want to make sure I am using something that will provide the best performance for my case and also be something easy to maintain later on.

    The first table has the shorthand codename for my store, and the other table has the full address of the store. So I want to be able to link those two strings together as easily and efficiently as possible. Thank you in advance!

  • I have two ideas of how you can create an association between two values on different tables, one will store the association at the application level within a truth table and the other would store it within the database level.

    With the [b]truth table[/b] method, you can feed in a string for the code name, and it can churn out the matching address for the store. In the Truth Table editor, there is a configuration under the Advanced menu in its properties to Return Only First Result that should be toggled on for this.

    The other idea is to have [b]an additional column in either of the tables[/b] as a [b]foreign key[/b] to reference the other tables primary key. For example, in the first database table we could create a column that contains the IDs of each full address. In a flow all we would need to do at this point is use a fetch entities step to fetch the table that has the foreign key column then we would have enough information to find the matching data in the other table.

    Both of these would be an efficient way to accomplish your goal. If were expecting large amounts of traffic through this flow, or if its expensive to write to those external databases, then the truth table would be the more viable option so you should proceed with your initial idea if that is the case. Truth tables display all the information in a straightforward manner and are easy to update as needed which also fits your other caveat. Hope this helps!

Sign In or Register to comment.