在没有子查询的情况下转换 sql 查询

converting a sql query without sub query

有没有一种方法可以将此查询转换为一个查询,而无需在 where 子句中包含子查询?

      select distinct 
          ie.install_id
        , ie.sp_id
        , ie.device_config_id
        from d1_sp sp
        inner join install_evt ie  
            on ie.sp_id = sp.sp_id
        where ie.install_dttm = (select max(iemax.install_dttm)
                                    from install_evt iemax
                                    where iemax.sp_id = sp.sp_id)
      select distinct 
          ie.install_id
        , ie.sp_id
        , ie.device_config_id
        , max(ie.install_dttm)
        from d1_sp sp
        inner join install_evt ie  
            on ie.sp_id = sp.sp_id
group by           ie.install_id, ie.sp_id, ie.device_config_id

如果您需要额外的分组,您可以使用 order by