Left join 的简单运用

来源:互联网 发布:slackware linux 编辑:程序博客网 时间:2024/06/10 03:37

left join on的简单三表关联

 大家好 我是wasdzjh 很高兴你们能光临小弟的博客,小弟也希望能有更多的知识分享给大家。废话不多说了,开始。

left join on 大家可以去百度具体的定义,我也就不在这里多说什么了。直接上语句 代码。

三表:

part表
part_id  description specification product_code brand uom  purchase vendor_id drawing_file lead_time batch 

inv_qr_line表

trans_no line_no part_id quantity unit_price amount location_id remark spec_add unit create_time edit_time

shipper_line表

trans_no line_no part_id location_id quantity unit_price amount ship_to_id remark create_time 


select part.part_id, part.description ,part.specification,inv_qr_line.create_time,inc_qr_line.quantity,

shippe_line.create_time,shipper_line.quantity from  part left join inv_qr_line on part.part_id = inv_qr_line.part_id  left join shipper_line on part.part_id = shipper_line.part_id

最后传上图片让大家看看结果