Prisma ORM · Prisma Client queries
Group rows
Group by a field and count each group.
const byRole = await prisma.user.groupBy({ by: ["role"], _count: { _all: true } });
Official Prisma ORM documentation
Prisma ORM · Prisma Client queries
Group by a field and count each group.
const byRole = await prisma.user.groupBy({ by: ["role"], _count: { _all: true } });
Official Prisma ORM documentation
Was this page helpful?