I got these three tables s,a and p. a and s got 1:1 relation. But a to p got 1:x relation. My current query is only build for 1:0 or 1:1 relation. Currently I'm getting: "ORA-01427: single-row subquery returns more than one row." If there's more than one resource_id for an activity_no
So how do I redo my query so If there's two or more resource_id for an activity_id I want to duplicate the selected row two or more times depending on how many resource_id there is for an activity_no?
I've been looking on: Oracle, insert multirows from subquery with more than one row but It doesn't work.
select s.sub_project_id,
a.activity_no,
(select p.resource_id
from p
where p.project_id = 'PROPSTOT'
and p.activity_seq = a.activity_seq,
from s,
a
where s.sub_project_id = a.sub_project_id
and s.project_id = 'PROPSTOT'
and a.project_id = 'PROPSTOT'