列子:
select * from comfitinto where sortld={select sortld from cmmocad where sortname=’手机’}
子查询:在一个查询语句中包含了另外一个查询语句。
简单子查询的语法:select ……from表1 where 列>(子查询)
如: 我要查看 Q3扰流板的库存 首要要知道 Q3扰流板的fitemid
根据id在库存里面查看相应的库存信息
select * from 库存表 where fitemid={select fitemid from t_icitem where fname=’Q3扰流板’}
例子 Select ordered,orderdate,(Select sum(d.line)From orderdatail as d Where d.orderId = o.orderID) AS ordertotal From orders as o