How to filter query based on children table?
Hi friends, first time using Drizzle so be gentle, this question may be dumb.
I designed a model where I have a country table and a country_language table, as you can see in the attachment.
Let's say that I want to return the country which has the slug (from the country_language table)="portugal-en". How can I write that expression?
Here's my try:
However, this is returning the first country and then just filtering the country_languages table, which is not what I want. I tried to move the where clause to the country level, but didn't worked, since that column (slug) does not exist on the country table).
Thank you!
3 Replies
They removed the ability to select base on nested relations in v0.28
But this can be done with a subquery or an inner join
Take a look at this example for something similar: https://discord.com/channels/1043890932593987624/1166190702984708126/1166200301133504522
Do you know why they removed it?
Yes, it's on the release notes