Julian
06/13/2022, 2:43 PMconst amountMale = await this._prismaService.$queryRaw`
SELECT
COUNT(profile) as count
FROM "public"."User" AS user, "public"."Profile" AS profile
WHERE user.profileId = profile.id
WHERE profile.gender = MALE
`
I get the following error:
Raw query failed. Code: `42601`. Message: `db error: ERROR: syntax error at or near "user"`
It is solved by removing the AS user
and AS profile
parts, but then it gives an error on WHERE User.profileId = Profile.id
saying the .
is an invalid character.
Is there any way to solve this? Prisma version is 3.13, using PostgresqlRichard Ward
06/14/2022, 6:30 AM"
:
WHERE "User".profileId = "Profile".id
Nurul
06/14/2022, 4:35 PM"
?
const amountMale = await this._prismaService.$queryRaw`
SELECT
COUNT(profile) as count
FROM "public"."User" AS user, "public"."Profile" AS profile
WHERE "user"."profileId" = profile.id
WHERE "profile"."gender" = MALE
Julian
06/14/2022, 5:40 PMu
as name instead of user
, I think it might have been related to that? But not sure