Sample Header Ad - 728x90

SQL Error [1242] [21000]: Subquery returns more than 1 row (AMATEUR)

1 vote
2 answers
4290 views
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!
Asked by 7up234 (19 rep)
Dec 2, 2020, 07:32 PM
Last activity: Nov 30, 2023, 09:08 AM