MySQL Forums
Forum List  »  Newbie

subselect fails
Posted by: Brian Case
Date: June 19, 2018 10:27AM

project is a one-to-many releation to workunit on projectid.
workunit is a zero to many relation to billing on workunitid.

I want to get all workunits with any associated billings for a project id.

This works to get the workunitid.
select workunit.workunitid from project left join workunit on workunit.projectid = project.projectid where project.projectid = 9)

But when I include it as a subselect the billing,
select workunit.*, billing.* from workunit left join billing WHERE workunitid in (select workunit.workunitid from project left join workunit on workunit.projectid = project.projectid where project.projectid = 9)

fails withe message "... right syntax to use near 'where workunitid in (select workunit.workunitid from project left join workunit'

Among the things I tried is to qualify the where to read 'where workunit.workunitid in' and 'where billing.workunit in'

Options: ReplyQuote


Subject
Written By
Posted
subselect fails
June 19, 2018 10:27AM
June 19, 2018 12:01PM
June 19, 2018 02:20PM
June 19, 2018 02:45PM
June 22, 2018 12:31PM
June 22, 2018 03:09PM
June 22, 2018 03:19PM
June 19, 2018 02:30PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.