Select row, show related table by id

Hello everyone, maybe my question is trivial but I can't do it, I'm still in the study phase, I hope someone can help me.
I have two tables, one with employee data and one with the delivery of material made to each employee, in the db the two ids are connected, I would like when you select his row from the employee's table to show the table with the materials delivered but I can't build the right query.

Hey @acipriani, welcome to the community :hugs:

That's a very common use-case and the solution should be rather simple :))

The second table's query that fetches the delivery records just needs a filter taken from the selected row of the first table.

Let's say you're using a postgresql query to retrieve that information. It would look like this:

SELECT
  *
FROM
  db.deliveries AS delivery
WHERE
  delivery.employee_id = {{ employees_table.selectedRow.data.id }}

Would that work for you?

Thank you very much for your help, in fact it was very simple and available everywhere. I managed!! :slight_smile: