Does Prisma support nested queries e.g. `SELECT .....
# orm-help
s
Does Prisma support nested queries e.g.
SELECT ... FROM (SELECT ... FROM xxx)
? I need to run a query and do some more stuff (aggregation, sorting) with its results. I would like to do that in the database rather than manually in my app (e.g. with
result.sort(...)
or
result..reduce(...)
). Is there a way?
m
n
Hey 👋 As of now, Indeed you would need to use Raw Query for doing nested select queries.
s
@Nurul @mjyoung I see, thanks. But raw queries don’t support
@map
(see docs), right? I need all my queries to work even if the table names change.
n
Raw Queries expect the actual table name in the database and not the model name, so if your table names are going to change then indeed you would need to update it in the raw query.
s
@Nurul Okay, thank you very much. Then I’ll run the subquery via Prisma and do the rest “manually” through Typescript 👍. Thank you very much for your help.
🙌 1
n
No worries! 🙌