确切来说有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最差
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最差