Counting relations can’t have a `where`, right? - ...
# orm-help
p
Counting relations can’t have a
where
, right? - https://www.prisma.io/docs/concepts/components/prisma-client/aggregation-grouping-summarizing#count-relations - eg, we can get all users with a count of posts, but we can’t get all users with a count of Published posts..
n
Hey 👋 You are probably looking for filtered counts. Can you have a look and let me know if this is what you were looking for?
p
@Nurul thanks for the reply, but no. I’m trying to get all companies with their active users (so, ideally, I get a company, al it’s fields, and a count of users, but the users have a “where”).
I could do a filtered count in a loop for every company (and I’ll probably have to resolve to this), but that’s hundreds of queries instead of one
n
Got it, we do have an existing Feature Request which describes what you need to achieve, if you could leave a 👍 to the request it would help our engineering and product team prioritise it. https://github.com/prisma/prisma/issues/8413
🙌 1