I want to create a query over multiple tables, let's say orders, customers, and countries, to retrieve a list of orders along with customer information and the country information of each customer.
The orders table has a foreign key customer_id referencing the customers table, and the customers table has a foreign key country_id referencing the countries table.
In SQL, you can achieve this using nested LEFT JOINs like this:
SELECT
o.order_id,
c.customer_name,
co.country_name
FROM
orders o
LEFT JOIN
customers c ON o.customer_id = c.customer_id
LEFT JOIN
countries co ON c.country_id = co.country_id;
In Tinybase, it seems like I cannot replicate the second join condition.
If I do join("countries", "country_id"), I don't get any results.
Perhaps the join condition could allow for something like join("countries", "customers.country_id")?
I want to create a query over multiple tables, let's say
orders
,customers
, andcountries
, to retrieve a list of orders along with customer information and the country information of each customer. Theorders
table has a foreign keycustomer_id
referencing thecustomers
table, and thecustomers
table has a foreign keycountry_id
referencing thecountries
table.In SQL, you can achieve this using nested LEFT JOINs like this:
In Tinybase, it seems like I cannot replicate the second join condition. If I do
join("countries", "country_id")
, I don't get any results.Perhaps the join condition could allow for something like
join("countries", "customers.country_id")
?Any thoughts?