效果:查询出某个订单中,模块的测试信息
两个表的连接条件是 chip_id 字段相同
# 可以对表进行命名
select * from order_productioninfo
INNER JOIN order_module
on order_productioninfo.chip_id=order_module.chip_id
where order_module.order_name="order_1123"
# 必须对 select * from order_module where order_name="order_1123" 中间表命名才能继续查询
select * from order_productioninfo
INNER JOIN (select * from order_module where order_name="order_1123") as temp
on order_productioninfo.chip_id=temp.chip_id
select * from order_productioninfo
INNER JOIN order_module
on order_productioninfo.chip_id=order_module.chip_id
where order_module.order_name="order_1123"
GROUP BY order_productioninfo.chip_id
ORDER BY order_productioninfo.pt_time desc