© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
4 replies
mansedan

Filtering by foreign key & .or

Hey all,

We are trying to effect a query by checking for a
ilike
ilike
match in either column (home_team or away_team) both serving as a Foreign Key to the same table. We are trying like this:

const { data, error } = await supabaseClient.from('table').select(`home_team!inner(*),away_team!inner(*)`).or(`mascot.ilike.%${q}%`, { foreignTable: 'home_team' }).or(`mascot.ilike.%${q}%`, { foreignTable: 'away_team' })
const { data, error } = await supabaseClient.from('table').select(`home_team!inner(*),away_team!inner(*)`).or(`mascot.ilike.%${q}%`, { foreignTable: 'home_team' }).or(`mascot.ilike.%${q}%`, { foreignTable: 'away_team' })


and

const { data, error } = await supabaseClient.from('table').select(`home_team!inner(*),away_team!inner(*)`).or(`mascot.ilike.%${q}%`, { foreignTable: ['home_team', 'away_team'] })
const { data, error } = await supabaseClient.from('table').select(`home_team!inner(*),away_team!inner(*)`).or(`mascot.ilike.%${q}%`, { foreignTable: ['home_team', 'away_team'] })


With no real luck. Is there a way to do the query we are attempting?
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

Filtering results by foreign key via cURL request
SupabaseSSupabase / help-and-questions
4y ago
Composite key foreign key issue
SupabaseSSupabase / help-and-questions
6mo ago
violates foreign key constraint
SupabaseSSupabase / help-and-questions
4y ago
Foreign Key Array Columns
SupabaseSSupabase / help-and-questions
4y ago