Is it possible to perform join on Bubble database?

Hi,

Is it possible to perfom joins on bubble database the way we do on SQL databases? If not is a working around to achieve the same result?

Here is an example of my SQL query:

SELECT s.sandwich_id, s.nome, s.preço_venda, s.custo, s.ingredientes, COALESCE(od.quantidade, 0) AS quantidade
FROM sandwiches s
LEFT JOIN (
    SELECT sandwich_id, COUNT(*) AS quantidade
    FROM order_details
    WHERE order_id = 9
    GROUP BY sandwich_id
) od
ON s.sandwich_id = od.sandwich_id
WHERE s.ativo = true
ORDER BY s.nome
LIMIT 200;

I have to datatables:

Sandwiches: it contains the sandwiches available for my sandwiche shop
Order details: for each sandwich added to the cart, a now row for that sandwich is created on this table.

The final result we’ll group the table order details for the correspoding order, summarizing the quantities of sandwich for each sandwich type, than join on Sandwiche table to retrieve fields like, Sandwiche name, main ingredients and others.

Is there a way to perform the same using only Bubble databases?

This topic was automatically closed after 70 days. New replies are no longer allowed.