I got a `questions` table with just a row of diffe...
# help
e
I got a
questions
table with just a row of different questions. Each question can have different answers. Those are in a table
answers
, containing a foreign key
question_id
. I use an API call to get the structure I want :
Copy code
js
let { data: questions, error } = await supabase
  .from('questions')
  .select(`
    question,
    answers(
      answer
    )
  `)
Copy code
json
[
  {
    "question": "question one",
    "answers": [
      {
        "answer": "answer one for question one"
      },
      {
        "answer": "answer two for question one"
      }
    ]
  },
  {
    "question": "question two",
    "answers": [
      {
        "answer": "answer one for question two"
      },
      {
        "answer": "answer two for question two"
      }
    ]
  }
]
But, for security reasons, I want to get the same result using a function and a RPC call. Unfortunately, I can't figure it out on my own. Is there a way to do it ?
n
Hello @enti! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
Thread was archived by @enti. Anyone can send a message to unarchive it.
enti (2022-04-19)