PrismaP
Prisma12mo ago
2 replies
Joseph Mansfield

Count records where number of related records is greater than X

Hey folks, I'm struggling to figure out the right way to express a particular query.

I have a model game and a related model like. A game has 0 or more likes related to it. What I want to get: the total number of games that have at least 5 related likes. Ideally I would do this without fetching unnecessary extra data from the database.

Appreciate any help, thanks.
Was this page helpful?