I have 2 tables. Staff and Branch. I want to list all of name on Staff which live in Branch in London. SELECT staffNo, fName, lName, branchNo FROM Staff WHERE branchNo= (SELECT branchNo FROM Branch WHERE city IN ("LONDON")); Code (markup): I am using MS. Access to test this query and I got error message: At most one record can be returned by this query. What's wrong? How to fix this query? Many thanks.
Try this: SELECT staffNo, fName, lName, branchNo FROM Staff WHERE branchNo= (SELECT branchNo FROM Branch WHERE city="LONDON" group by branchNo); Code (markup):
SELECT staffNo, fName, lName, Staff.branchNo as branchNO FROM Staff LEFT JOIN Branch ON Branch.branchNo = Staff.branchNo WHERE city = 'LONDON' Code (markup):