select Id from Advertising where adgroup in (select id from adgroup where adseries in(select id from adseries where same='sd'))如题。
能用什么代替好?

解决方案 »

  1.   

    select Id 
    from Advertising t
    where exists (
    select 1 from adgroup g
    where t.adgroup = id
    and exists(
    select id from adseries 
    where same='sd' 
    and g.adseries=id
    )
    )TRY
      

  2.   

    select Id 
    from Advertising t
    where exists (
        select 1 from adgroup g
        where t.adgroup = id
            and exists(
            select id from adseries 
            where same='sd' 
                and g.adseries=id
            )
        )
      

  3.   


    也不高 SQL查询会自动优化 其实都差不多 具体可以看执行计划