Skip to content

Or filtering across embedded resources query construction #3748

Answered by laurenceisla
shania-g asked this question in Q&A
Discussion options

You must be logged in to vote

How can I do this?

You need to use b.not.is.null inside the or and filter the b table outside of it. Something like this:

curl 'http://localhost:3000/a?select=*,b(*)&b.user_id=eq.8d084598-9a33-4766-ab97-b27d86c69759&or=(user_id.eq.8d084598-9a33-4766-ab97-b27d86c69759,b.not.is.null)'

It could be read like this: "Get data from the a table, where the user_id is 8d084598-9a33-4766-ab97-b27d86c69759 or where the filter for the b embed is not null".

As a follow up, you may want to get the data from the b table when the user_id is not equal to 8d084598-9a33-4766-ab97-b27d86c69759. The next part of the documentation mentions this, you would need one empty embed to filter and another to retrieve…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by shania-g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #3746 on October 11, 2024 17:27.