select scno from ys_stkscase 
where scno in(select forsobunsmandesc from ys_stkscase where scno in(select scno from ys_stksmoved where smno=5686852993763015071))
我只会这样写,
请帮忙用inner join写

解决方案 »

  1.   


    select scno from ys_stkscase as ys
    where  exists (
    select forsobunsmandesc from ys_stkscase 
    where exists (select scno from ys_stksmoved where scno=ys_stkscase.scno smno=5686852993763015071) and
    ys.scno=forsobunsmandesc
    )
      

  2.   


    select a.scno 
    from ys_stkscase a join ys_stkscase b on a.scno = b.forsobunsmandesc
    join ys_stksmoved c on a.scno = c.scno
    where c.smno=5686852993763015071
      

  3.   

    本人认为exists必inner join效率要好。 所以用exists了。