Left join 顯示左邊表格所有資料。
table01資料表內容
  
table02資料表內容
  
查詢語法
SELECT a.column01, a.column02, b.column01, b.column02 FROM table01 as a left join table02 as b on a.column01 = b.column01
結果
  
table01資料表內容
| column01 | column02 | 
|---|---|
| test01 | 測試01 | 
| test02 | 測試02 | 
| column01 | column02 | 
|---|---|
| test01 | 1 | 
| test03 | 2 | 
| test04 | 3 | 
SELECT a.column01, a.column02, b.column01, b.column02 FROM table01 as a left join table02 as b on a.column01 = b.column01
結果
| column01 A | column02 A | column01 B | column02 B | 
|---|---|---|---|
| test01 | 測試01 | test01 | 1 | 
| test02 | 測試02 | test02 | 
留言
張貼留言