Nested select query from multiple tables #490
Unanswered
issamwahbi
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello
First of all thank you for this great package.
I am using Slonik in a DDD context where Slonik is my persistance layer.
I need to do nested Select to retrieve in one shot multiple table and construct one object from them.
For exemple, I have 2 Zod schema as bellow :
I cannot do queries directly on the vehicules table following the DDD principales... So I need to query the employees table and get the vehicules along it.
The SQL query that I am trying to execute is the following :
It is working well when done like above. But since I am using a repository pattern I need to make it dynamic.
I did the following, which is working well. But I cannot tell if the solution above is bullet prove or has some downsides:
Beta Was this translation helpful? Give feedback.
All reactions