using subquery with query builder
Hello ๐ Please help me ) I try to use subquery with query builder, but i get a type error in eq function. How can i fix it?
![No description](https://cdn.answeroverflow.com/1177249410103656468/image.png)
6 Replies
The type SubqueryWithSelection doesn't know anything about the id
Check what type is your SQ and copy it from there
Hello ๐ thank you for response )
SubqueryWithSelection<K, 'sq'> ( K extends ReturnType<typeof this.roleFind>['_']['selection'])
K extends selection type of role select knows about id. I think it is error of eq function argument type. Maybe i can use magic sql for this ? ๐![No description](https://cdn.answeroverflow.com/1177268328000143400/image.png)
![No description](https://cdn.answeroverflow.com/1177269387011575818/image.png)
I found solution with using magic sql ๐
![No description](https://cdn.answeroverflow.com/1177275330906570833/image.png)
please tell me how can i get subquery columns like
getTableColumns
for table ?Not implemented yet. The issue to track is https://github.com/drizzle-team/drizzle-orm/issues/1459
GitHub
[FEATURE]: Add
getSubqueryFields
helper to goodies ยท Issue #1459 ...Describe what you want The getTableColumns helper is really useful, but an equivalent lacks for subqueries. This can easily be implemented in userland, although it feels like the kind of helper tha...