Can't seem to $count in multi relation query
I trying to get the count of "clicks" from a table 2 relations deep.
Querying for posts by a creators id, getting each posts link for a given guild id, and counting a clicks table tracking clicks for a given link.
I can't for the life of me find a nice way to do this in drizzle any assistance would be helpful!
Here's the current prisma implementation.
and relevant output
This is what I assumed would work in drizzle based on https://orm.drizzle.team/docs/select#count but getting a really weird
It's like it's not using shareClicks from
Querying for posts by a creators id, getting each posts link for a given guild id, and counting a clicks table tracking clicks for a given link.
I can't for the life of me find a nice way to do this in drizzle any assistance would be helpful!
Here's the current prisma implementation.
and relevant output
This is what I assumed would work in drizzle based on https://orm.drizzle.team/docs/select#count but getting a really weird
column posts_links.link_id does not exist error.It's like it's not using shareClicks from
import { shareClicks } from '@drizzle/schema'; but instead referencing something else.Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.