Hey I have the following problem: ``` select * ...
# sql
j
Hey I have the following problem:
Copy code
select
  *
from
  calculator_screens
  inner join calculator_answers answer on answer.calculator_screen = calculator_screens.id
That's my pure sql query, working fine. I am trying to do the same on the frontend, what would the query look like? I have a third table
calculator_moves
that has a foreign key to a
calculator_answer
and to
calculator_screens
. Anything I try using postgrest ends in an
More than one relationship was found for calculator_screens and calculator_answers
error even though
calculator_moves
is never touched Do i need to use stored procedure to run my query?
s
Yes it's to use a store procedure for complex queries, the frontend library select method is only meant for simple queries.
r
If you have a relationship between screens and answers, how about:
Copy code
await supabase
  .from('calculator_screens')
  .select('*, calculator_answers!calculator_screen(*))
j
Thanks man! I clearly read over that part in the documentation. Works fine as expected. No need for stored procedures @User