Hi all! I have a problem with queryRaw: I’m trying...
# orm-help
n
Hi all! I have a problem with queryRaw: I’m trying to run a query that returns multiple columns with the same name (it’s a join between multiple tables). Unfortunately, when prisma converts it to a JS object, the object only contains the last column. So if I have 2 createdAt columns, the first one has a value and the second one has NULL, it will return createdAt: NULL. Is there any kind of easy fix for this?
r
The only workaround is renaming the columns that have the same name in your raw query.
n
Okay, thx!
👍 1
r
@Nichita Z not sure you are aware but you can use
as
in the "select portion" to do this:
Copy code
select a.id as aId, b.is as Bid
from A as a
join B as b on a.x = b.x