1的语法有问题,子查询有两个以上的返回记录就会出错

解决方案 »

  1.   

    确切来说有3种写法:
    1.
    select 物品,数量 from 表2 b where 订货单 in((select 订货单 From 表1 a where a.订货人=... and a.订货时间=...)
    2.
    select 物品,数量 from 表2 b where exists((select 订货单 From 表1 a where a.订货单=b.订货单 and a.订货人=... and a.订货时间=...)
    3.
    select b.物品,b.数量 From 表1 a inner join 表2 b on a.订货单=b.订货单 Where a.订货人=... and a.订货时间=...2.3差不多,1最差