因为这一句where TA.GoodName = TB.GoodsName
使得条件只能选择"A","C","E"

解决方案 »

  1.   

    select TA.GoodName,(TA.A-isnull(TB.B,0)) as 库存 from
    ((select GoodName,sum(InNumbers)as A from InTable Group by GoodName )TA left outer join
    (select GoodsName,sum(OutNumbers) as B from OutNumbers group by GoodsName)TB
    where TA.GoodName = TB.GoodsName)
      

  2.   

    改一下
    select TA.GoodName,(TA.A-isnull(TB.B,0)) as 库存 from
    ((select GoodName,sum(InNumbers)as A from InTable Group by GoodName )TA left outer join
    (select GoodsName,sum(OutNumbers) as B from OutNumbers group by GoodsName)TB
    on TA.GoodName = TB.GoodsName)
      

  3.   

    问题是在access 数据库中什么TA left outer join好像都是通不过的呀。