Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabaseβ€’4y agoβ€’
8 replies
Kcrik

Complex or(), and with inner join not working

Hello guys,

I am trying to build a more or less complex queries, with or() and..and inside the or().

.select(

      *,
      equipment: equipment_id!inner(
        *,
        location: location_id!inner(*)
      ),
      equipment_purchase: equipment_purchase_id!inner(
        *,
        order_product: order_product_id!inner(
          *,
          order: order_id!inner(*)
        )
      )
    

      *,
      equipment: equipment_id!inner(
        *,
        location: location_id!inner(*)
      ),
      equipment_purchase: equipment_purchase_id!inner(
        *,
        order_product: order_product_id!inner(
          *,
          order: order_id!inner(*)
        )
      )
    
)
.eq("is_removed", params.is_removed)
.or(
equipment_purchase_id.is.null, and(equipment_purchase.neq.null, and(equipment_purchase.order_product.is_removed.eq.false, equipment_purchase.order_product.order.status.eq.completed))
equipment_purchase_id.is.null, and(equipment_purchase.neq.null, and(equipment_purchase.order_product.is_removed.eq.false, equipment_purchase.order_product.order.status.eq.completed))
)

The client is complaining that 'equipment_purchase.order_product' doesn't exist, but it does.

if I do something like
.eq("equipment_purchase.order_product.is_removed", false), it doesn't complain and works.
So I am unsure on what's the issue, and if my only (current) solution is to do a post-processing filtering ?

Thank you in advance.
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Inner join not returning data
SupabaseSSupabase / help-and-questions
13mo ago
inner join really slow
SupabaseSSupabase / help-and-questions
4y ago
Inner Join in Dart
SupabaseSSupabase / help-and-questions
4y ago
Model Complex Join Tables
SupabaseSSupabase / help-and-questions
3y ago