答案 0 :(得分:0)
假设BOOK
表的列AID
是指向AUTHORID
表的AUTHOR
的FK。
有很多方法可以这样做。
内部查询
SELECT B.* FROM BOOK B WHERE B.AID IN (SELECT AID FROM BOOK WHERE TITLE LIKE '%?%');
<强>乔伊纳强>
SELECT B1.* FROM BOOK B1 , BOOK B2 WHERE B1.AID = B2.AID AND B2.TITLE LIKE '%?%';
左外连接
SELECT B1.* FROM BOOK B1 LEFT OUTER JOIN BOOK B2 ON B1.AID = B2.AID WHERE B2.TITLE LIKE '%?%';