© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3y ago•
2 replies
Polaar

Combining AND and OR statements

Hello, im trying to make a query from react native to supabase, with the logic of having a query lke this: "Select * from table where (requester_id = id and requestee_id = another_id) OR (requester_id = another_id and requestee_id = id)".. i did something like this:
 const {data, error} = await supabase
        .from(table)
        .select()
        .or(
            `requester_id.eq.${requester_id},and(requestee_id.eq.${requestee_id})`
            )
        .or(`requester_id.eq.${requestee_id},and(requestee_id.eq.${requester_id})`)
 const {data, error} = await supabase
        .from(table)
        .select()
        .or(
            `requester_id.eq.${requester_id},and(requestee_id.eq.${requestee_id})`
            )
        .or(`requester_id.eq.${requestee_id},and(requestee_id.eq.${requester_id})`)
and this provides wrong results. what would be the correct js code for this?
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

Combining vector and normal indexes?
SupabaseSSupabase / help-and-questions
13mo ago
IF statements in RPC
SupabaseSSupabase / help-and-questions
4y ago
Confusion when combining createServerSupabaseClient and clientside auth helpers (Next.js).
SupabaseSSupabase / help-and-questions
4y ago
Help with SQL conditional statements inside Supabase policy.
SupabaseSSupabase / help-and-questions
4y ago