Lucid ORM - Join table alias column not appearing #4039
Unanswered
Adam-Example
asked this question in
Help
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.
-
Im attempting to order by a relation column, and also include the relation column in the select statement. I have looked around, but cant seem to figure it out, I am using the solution posted by @thetutlage from this.
This works, but run into problems when trying to include specific columns from the joined table, Aliases with names from columns that already exist on the model will display. How can i get the 'newAlias' to display, is there a way to add alias or joins onto model?
const tasks = await Task.query() .join('project_groups AS group', 'group.id', 'tasks.group_id') .orderBy('group.id', 'desc') .select({ id: 'tasks.id', newAlias: 'group.id' })
Beta Was this translation helpful? Give feedback.
All reactions