P
Prisma8mo ago
Mert Efe

Raw query doesn't work

let result: any = await this.prisma.$queryRaw`
select V.name, V.id, SUM(O."amount"::BIGINT)::BIGINT
from "Variety" V
left join "Flower" as F on F."varietyId" = V.id
left join "Orderline" as O on O."flowerId" = F.id

group by V.id, V.name`;
let result: any = await this.prisma.$queryRaw`
select V.name, V.id, SUM(O."amount"::BIGINT)::BIGINT
from "Variety" V
left join "Flower" as F on F."varietyId" = V.id
left join "Orderline" as O on O."flowerId" = F.id

group by V.id, V.name`;
Do not know how to serialize a BigInt
2 Replies
Mert Efe
Mert EfeOP8mo ago
SUM(O."amount"::INT) this worked why?
StoicWanderer
StoicWanderer8mo ago
A BigInt usually has a trailing n at the end of the stringified number e.g. 2n
Want results from more Discord servers?
Add your server