2012-11-14 19 views
0

我有table1A , B , C和另一個table2A, DSQL查詢選擇一個空列的視圖

我想創建一個視圖以顯示列A, B, C, D應該還有A列的所有值,即使沒有Atable2

我想:

select 
    a, b, c, d 
from 
    table 1 
inner join 
    table 2 where table1.a = table2.a 

提出好的建議

+1

Rob Paller非常感謝你.........它的工作原理:d乾杯.... – user1820110

回答

2

你會想要使用一個外部連接:

SELECT t1.a, t1.b, t1.c, t2.d 
FROM table t1 
    LEFT JOIN table t2 
    ON t1.a = t2.a;