How can I create a select query that uses subqueries? #210
-
I need to implement the following query |
Beta Was this translation helpful? Give feedback.
Answered by
giannism13
Jun 28, 2023
Replies: 1 comment 2 replies
-
Not sure how your tables relate to each other. Take a look at https://supabase.com/docs/guides/api/joins-and-nesting. const { data, error } = await supabase.from('countries').select(`
id,
name,
cities ( id, name )
`).eq('cities.id', 1) Then it would be like this for Kotlin: val countries = Columns.raw("""
id, name, cities(id, name)
""".trimIndent())
val country = client.postgrest["countries"].select(columns) {
eq("cities.id", 1)
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Correct me if I'm wrong but your proposal essentially is a join, which is different from what I'm trying to do. I did a little digging and it seems that Supabase does not support subqueries. Instead I had to use a function and rpc.