Does anyone know if it is possible to re-create th...
# orm-help
s
Does anyone know if it is possible to re-create this query inside of Prisma 3. I didn't think it was possible in Prisma 2.
Copy code
SELECT inviterId, count(*) as count FROM invites where serverId = ${member.guild.id} AND valid = 1 GROUP BY inviterId ORDER BY count DESC LIMIT 10
r
Try this:
Copy code
prisma.invites.groupBy({
	by: ["inviterId"],
	_count: { inviterId: true },
	orderBy: { _count: { inviterId: "desc" } },
	where: { serverId: member.guild.id, valid: 1 },
    take: 10
});
💯 1