我正在尝试构建一个查询,该查询将允许我拉出具有已定义属性的人。
+----------------------------------------------------+
TABLE: Person
+----------------------------------------------------+
owner_id | name
1 | kevin
2 | lee
+----------------------------------------------------+
TABLE: Attributes
+----------------------------------------------------+
id | owner_id | attributes_id
1 | 1 | 52
2 | 1 | 53
3 | 1 | 23
4 | 2 | 52
SELECT Person.name FROM Person LEFT JOIN `Attributes` ON `Attributes`.`owner_id` = `Person`.`owner_id` WHERE Attributes.attributes_id = 52 AND Attributes.attributes_id = 53;
使用 where 子句没有返回 owner_id 1。如果有人能指出我正确的方向,我会非常感激!