1

I have 3 tables in supabase.

  • Message --> with foreign key 'request_id' to table Product_Request
  • Product_Request --> with foreign key 'product_id' to table Product
  • Product

How can i select all messages data with info from the others table?

I tried this:

let { data, error } = await supabase .from("message") .select("*, product_request(*), product(*)");

but give me this error:

{ "details": "Searched for a foreign key relationship between 'message' and 'product' in the schema 'public', but no matches were found.", "hint": "Perhaps you meant 'product_request' instead of 'product'.", "message": "Could not find a relationship between 'message' and 'product' in the schema cache" }

1 Answers1

0

This should do:

const { data, error } = await supabase .from("message") .select("*, product_request(*, product(*))"); 
dshukertjr
  • 15,244
  • 11
  • 57
  • 94