P
Prisma3mo ago
sommeeer

anyway i can have the _sum in this findMany()

Anyway I can have the _sum in findMany() or should i use typescript to get the sum?
const bookings = await db.booking.findMany({
select: {
courseId: true,
totalPersons: true
},
});

const sum = await db.booking.aggregate({
_sum: {
totalPersons: true,
},
});
const bookings = await db.booking.findMany({
select: {
courseId: true,
totalPersons: true
},
});

const sum = await db.booking.aggregate({
_sum: {
totalPersons: true,
},
});
0 Replies
No replies yetBe the first to reply to this messageJoin