Hi all, thanks in advance if you are able to help ...
# sql
j
Hi all, thanks in advance if you are able to help ! ⭐ I wish to execute this statement and trying to find how I can do it with the api
Copy code
sql
SELECT *
FROM public.articles AS articles
WHERE EXISTS(
  SELECT FROM public.articles_filters 
  WHERE public.articles.id = article_id AND filter_id = 'bfc8c9ca-361c-51d5-be59-e2ce0aa7e6a6'
)
if I use
Copy code
javascript
.select(`*, articles_filters!inner(*)`)
.eq('articles_filters.filter_id', 'bfc8c9ca-361c-51d5-be59-e2ce0aa7e6a6')
and because of the inner join it only returns the articles with the one articles_filters, while I would like to return with all of them as you do with .select(
*, articles_filters(*)
) but with the ability to filter I tried .filter(), but it seems that I still need to use !inner Kind regards, Joe
g
I believe you are trying to do what is at this link: https://github.com/supabase/supabase/discussions/6587 And so something like this:
Copy code
.select(`* my_filters:articles_filters!inner(*), articles_filters(*)`)
.eq('my_filters.filter_id', 'id')
j
super gary! I will give it a try ⭐
worked a treat, thanks again!