Halvor
08/06/2021, 10:05 PMmodel StatGamemode {
id Int @id @default(autoincrement())
type Gamemode
matches_played Int @default(0)
statGamemodeDM StatGamemodeDM?
}
model StatGamemodeDM {
id Int @id @default(autoincrement())
statGamemode StatGamemode @relation(fields: [statGamemodeId], references: [id])
statGamemodeId Int
kills Int @default(0)
}
And my old query only summerizing the columns in StatGamemode looks like this:
const result = await prisma.statGamemode.aggregate({
_count: {
_all: true
},
_sum: {
matches_played: true,
//kills: true
},
where: {
type: gamemode
}
});
How can i summerize the "kills" column from StatGamemodeDM table in the same query?