Sql查詢 A 外連接 B 內連接 C A left join (B inner join C)

描述

今天在寫SQL的時候,要求是這樣的,A表是個總表;B和C表是個關聯表
需要用A表左關聯到B和C的結果集

實現

加入有表 product ,order、order_item

product left join (order join orderitem)


select * from product 
	left join 
		order join order_item 
			on order.order_id = order_item.order_id 
	on product.product_id = order_item.product_id

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章