第一頁 返回 繼續 最後一頁 概覽 圖形
Outer Join 指令
select service.sid, sum(sale.num) from sale,
service where sale.sid=service.sid group by service.sid;
- 編號6的服務點因為業績0所以不會被列出來
- outer join 可以強制列出所有的服務點,不管有無關聯到銷售表格
select service.sid, sum(sale.num) from sale right join service on sale.sid=service.sid group by service.sid;
select service.sid,sum(sale.num) from service left join sale on sale.sid=service.sid group by service.sid;