Reputation: 187
I hope anyone can help me :) My problem is when i run my code i am seeing this error " SQL command not properly ended" and "example" is red. Thank you for your interested
(select mat.oid matoid
from lsn.material mat,
lsn.plan_def def,
lsn.unit meu
where math.plan_def_oid = def.oid
and math.unit_oid = meu.oid
)example left join lsn.plan_det det on det.def_oid = example .matoid;
Upvotes: 0
Views: 180
Reputation: 522712
I think you can just join all four tables together in one go:
select math.oid matoid
from lsn.material mat
inner join lsn.plan_def def
on math.plan_def_oid = def.oid
inner join lsn.unit meu
on math.unit_oid = meu.oid
left join lsn.plan_det det
on plan_def_oid = math.oid
Changes I made here include converting your implicit joins to explicit inner joins. As a general rule, you should avoid putting commas into the from
clause. Also I moved your original incomplete subquery out to the main query.
Upvotes: 1
Reputation: 4432
In addition, it looks like there is a reference to a RESULTS table that is missing
Upvotes: 1