且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

仅选择与 IN 子句中指定的所有值匹配的那些行

更新时间:2023-08-25 23:13:22

有一个子查询,返回具有所有 3 个模型 (1081,1082,1083) 的引擎.

Have a sub-query that returns engines having all 3 models (1081,1082,1083).

select color
from car
where engine in (
    select engine
    from car
    where model in (1081,1082,1083)
    group by engine
    having count(distinct model) = 3)