更新时间:2023-02-15 18:26:09
此查询结构避免了使用唯一子句的情况(前提是解析表中没有重复的记录).
This query structure avoids the need for a distinct clause (provided there are no duplicate records in the resolution table).
SELECT p.PlantID
FROM
Plant p INNER JOIN PlantAttribute pa
ON p.PlantID = pa.PlantID AND pa.AttributeID = 1
INNER JOIN PlantAttribute pa2
ON p.PlantID = pa2.PlantID AND pa2.AttributeID = 2;