Select from joined models #133
Unanswered
iateadonut
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.
-
I'm doing this:
which results in this query/subquery:
select * from (select
projects
.* fromprojects
left joinusers
onprojects
.user_id
=users
.id
whereprojects
.deleted_at
is null group byprojects
.id
,users
.name
,users
.lastname
) asprojects
;I'm wondering how I can add a select to the subquery - I want to add
users
.lastname
to the select portion of the subquery, like this:select * from (select
projects
.*,users
.lastname
fromprojects
left joinusers
onprojects
.user_id
=users
.id
whereprojects
.deleted_at
is null group byprojects
.id
,users
.name
,users
.lastname
) asprojects
;Beta Was this translation helpful? Give feedback.
All reactions