Apologies if I have not posted this in the correct section. I am having some difficulties with some sub queries.
First I'd like to show the database design.
Ok so this is my table structure, simplified.
This is the query I am trying to run.
SELECT Rez_Desc.Rez_Number AS RezNum,
(SELECT OD.Label FROM Offsite_Desc OD
LEFT JOIN Rez_Desc AS RD ON OD.Offsite_ID = RD.Pickup_ID
AND RD.Rez_ID=Rez_Desc.Rez_ID) AS Pickup,
(SELECT AR.Label FROM Arrival_Desc AR
LEFT JOIN Rez_Desc AS RD ON AR.Arriving_ID = RD.Arriving_ID
AND RD.Rez_ID=Rez_Desc.Rez_ID) AS DropOff
And I get the following error:-
Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
To my knowledge and understanding it is being caused because the sub query is returning more than 1 result which it should not be doing. Seeing as how in my example table above I have 2 entries, both with relevant ID's etc.
Need some help!
View Complete Post