I have developed a problem using SQL Plus and Oracle 8i. I keep getting the error
ORA-01427: single-row subquery returns more than one row
I have Customers who have an id, Contacts, which are linked using the foreign key CustomerID and Licences which are linked using the foreign key CustomerID.
There are customers, who have may have none, one or many licences and contacts.
So I need to work out how to do a multiple-row subquery, as the query is producing the right results, but stops as soon as it gets to where there is more than one contact in the result set it errors.
[Select Customers.customerID, LicenceID,
(Select Contacts.CustomerID
FROM Contacts, Customers
Where Contacts.customerID (+)= Customers.customerID
FROM Customers, Licences
Where Customers.customerID = Licences.customerID]
Please help, I can't find any references on how to do multiple-row subqueries anywhere.
Thanks in advance
ORA-01427: single-row subquery returns more than one row
I have Customers who have an id, Contacts, which are linked using the foreign key CustomerID and Licences which are linked using the foreign key CustomerID.
There are customers, who have may have none, one or many licences and contacts.
So I need to work out how to do a multiple-row subquery, as the query is producing the right results, but stops as soon as it gets to where there is more than one contact in the result set it errors.
[Select Customers.customerID, LicenceID,
(Select Contacts.CustomerID
FROM Contacts, Customers
Where Contacts.customerID (+)= Customers.customerID
FROM Customers, Licences
Where Customers.customerID = Licences.customerID]
Please help, I can't find any references on how to do multiple-row subqueries anywhere.
Thanks in advance