9 Replies
Uh, i fixed it ;D
but this thing is kinda bad.
What is bad?
If the user has zero groups, i won't get an empty array, but i'd like to 😭
I tried do smth like this, but..
https://orm.drizzle.team/docs/joins#aggregating-results
Maybe I just need to aggregate the results within the js
After prisma sql-like seems quite complicated, but more efficient.
I'm not sure this will produce
[]
or [null]
This is another way https://stackoverflow.com/questions/24155190/postgresql-left-join-json-agg-ignore-remove-null
Stack Overflow
Postgresql LEFT JOIN json_agg() ignore/remove NULL
I am using a LEFT JOIN there will be cases where there is no right-table match therefore empty (null) values are substituted for the right-table columns. As a result I am getting [null] as one of the
yeap, thx ❤️