select t1.aa,t1.bb,t1.cc,
(select dd from zhj where xh=(select top 1 pp from xz where xh=110)),t1.ee,
(select top 1 qq from xz where xh=110),
(select top 1 ww from xz where xh=110)
from clzd as t1 
where t1.ff in (select bh from xz where xh=110)
请教怎么优化这个句子?

解决方案 »

  1.   

    select t1.aa,t1.bb,t1.cc,
    (select dd from zhj where xh=(select top 1 pp from xz where xh=110)),t1.ee,
    (select top 1 qq from xz where xh=110),
    (select top 1 ww from xz where xh=110)
    from clzd as t1 join xz on t1.ff=xz.bh
    where xz.xh=110
      

  2.   

    select t1.aa,t1.bb,t1.cc,t3.dd,t1.ee,t2.qq,t2.ww
    from clzd t1 
    join xz t2 on t1.ff=t2.bh
    join zhj t3 on t3.xh=t2.pp
    where t2.xh=110
      

  3.   

    access 下执行还是语法错误
    sql下可以通过
      

  4.   

    不要用 where...in(...)
    用inner join