Subject | Sub Query problem |
---|---|
Author | Andrew Barton |
Post date | 2001-02-11T23:42:23Z |
Hello all,
I have two tables that tie together to represent a many to many data
structure. One entity_name can be use in many 'branches' of related data.
I have a table of four fields :
ELink_id integer primary key
Root_id integer
Parent_id integer
Child_id integer
Root_Id represents the ELink_id of the node at the start of the new branch.
When I select a particular node (child_ID), I want to know what other
branches it exists in. I use the simple sql:
select Root_id
from tbl_entity_lnks
where child_id = :child_id
Then I get a summary of the branch numbers (root_id) that I am interested
in. I tried to then tie it together with :
Select l.elink.id, l.root_id, l.parent_id, l.child_id
from tbl_entity_lnks l
where l.root_id = (select sl.Root_id from tbl_entity_lnks sl
where sl.child_id = :child_id )
But I get a 'multiple rows in singleton select' error.
I would like to make this into a stored proc. Any ideas on how to get it to
operate?
Many thanks
Andrew Barton
I have two tables that tie together to represent a many to many data
structure. One entity_name can be use in many 'branches' of related data.
I have a table of four fields :
ELink_id integer primary key
Root_id integer
Parent_id integer
Child_id integer
Root_Id represents the ELink_id of the node at the start of the new branch.
When I select a particular node (child_ID), I want to know what other
branches it exists in. I use the simple sql:
select Root_id
from tbl_entity_lnks
where child_id = :child_id
Then I get a summary of the branch numbers (root_id) that I am interested
in. I tried to then tie it together with :
Select l.elink.id, l.root_id, l.parent_id, l.child_id
from tbl_entity_lnks l
where l.root_id = (select sl.Root_id from tbl_entity_lnks sl
where sl.child_id = :child_id )
But I get a 'multiple rows in singleton select' error.
I would like to make this into a stored proc. Any ideas on how to get it to
operate?
Many thanks
Andrew Barton