Being able to join data across multiple tables is a powerful feature of SQL, and you can use this Pack to join data across Coda tables.
Coda has built-in formulas and column types that allow you to combine data across tables, and whenever possible you are better off using them. Joining tables with this Pack is great when you want to use a type of join logic not supported by Coda, or want to easily join data across docs.
Join with matching values
Both the and tables contain a Country column with matching values. If you wanted to get a list of all of the countries where there is at least one employee and customer, you could join the tables as shown below. Join with lookups
The table below includes Lookup columns for the Customer and Employee that the order pertains to. On matching column
By default, Lookup columns will be loaded into SQL as text, using the display value of the row. For example, “LEHMS” for the customer . You can join that to the “Customer ID” column of the customers table. However it’s easy for the user to change the display value of a row, which will break your query.
On display value
Each loaded SQL table includes the special column _display, containing the display value for that row. Joining on that column will ensure a match even if the display column is later changed.
This option is not quite foolproof however, as there is nothing preventing multiple rows in a Coda table from having the same display value.
On row ID
To prevent collisions between rows with the same display value, a safer approach is to enable the parameter useRowIds. This changes how Lookup column values are loaded, storing the ID of the referenced row instead of it’s display value. For example, “i-OY7278FNnT” for the customer . Additionally, each loaded SQL table includes the special column _id, containing the unique ID for that row. Joining a these IDs is the safest option when dealing with lookups.