jaf
01/26/2022, 6:26 PMjavascript
const { data, error } = await db
.from('source_products')
.select('*, source_products!inner(*)')
.eq('id', id)
.eq('source_products.main_sku', 'how do I reference this')
.limit(1)
.maybeSingle()
Basically I want to join in other products that have the same value for main_sku
. Do I need to alias both 'tables' (it's the same table of course)
This works:
sql
select t1.*, t2.* from source_products t1 left join source_products t2 on t1.main_sku = t2.main_sku where t1.id = '4bfbf03d-9707-4b03-ac44-04fb7296a91a'
How do I do the same with supabase-js?Steve
01/26/2022, 10:28 PMmain_sku
a foreign key to source_products
?Steve
01/26/2022, 10:28 PMjaf
01/28/2022, 2:30 PM