just starting with supabase, I have a scenario where I need to filter the parent rows by a column in a related table. So far I have the following query:
<code>const query = this.#dbClient.from('chats').select(`
id,
created_at,
updated_at,
leads(state)
`);
if (props?.status === 'closed') {
await query.in('leads.state', ['recovered', 'errored', 'skipped', 'abandoned', 'abandoned_processing']);
}
</code>
<code>const query = this.#dbClient.from('chats').select(`
id,
created_at,
updated_at,
leads(state)
`);
if (props?.status === 'closed') {
await query.in('leads.state', ['recovered', 'errored', 'skipped', 'abandoned', 'abandoned_processing']);
}
</code>
const query = this.#dbClient.from('chats').select(`
id,
created_at,
updated_at,
leads(state)
`);
if (props?.status === 'closed') {
await query.in('leads.state', ['recovered', 'errored', 'skipped', 'abandoned', 'abandoned_processing']);
}
The issue is that this filters the lead state property, for instance if I set the status to closed, it still returns all the chats but does not return leads.state
where it’s closed. I’ve gone through the docs and forums but couldn’t find an answer, Any help or guidance would be appreciated, thanks!