有人可以告诉我这段代码有什么问题。基本上我要做的是根据他们的 ID 而不是名称来识别租户(以防有更多同名的租户)。谢谢
SELECT DISTINCT P.PROPERTYId, P.PROPERTYName, T.TYPEName
FROM RENTAL R, PROPERTY P, TYPE T
Group by P.PROPERTYId, P.PROPERTYName, T.TYPEName
HAVING RENTERId = (SELECT RENTERId FROM RENTER
WHERE RENTERFirstName = 'AL'
AND RENTERLastName = 'SMITH')
AND R.PROPERTYId = P.PROPERTYId
AND P.TYPEId = T.TYPEId
AND T.TYPEName = 'VILLA';