Basically, everything works in the brackets by itself. The statement in the brackets bring back 4 different values all on different rows.
How can I get around the fact that I need to apply the sql statement outside the brackets to the 4 values returned from the statements in the brackets when subqueries can only return 1 row?
SELECT
to2.Name, to2.PhoneNum
FROM
tbl_operatordesc to2
WHERE
to2.operatorID = (SELECT
to3.operatorID
FROM
tbl_operatorrouterelation to3
WHERE
to3.routeID = (SELECT
tr.routeID
FROM
tbl_route tr
WHERE
tr.`Start` = (SELECT
tb.busstopID
FROM
tbl_busstop tb
WHERE
tb.Description = 'Durham Estate')
OR tr.Destination = (SELECT
tb.busstopID
FROM
tbl_busstop tb
WHERE
tb.Description = 'Durham Estate')))
Thanks!
Best Answer
You should be joining between each table on the fields you're trying to compare in the WHERE clause. Then your statement can be on top of that.