我有一個這樣的查詢:連接多個記錄的一個記錄PostgreSQL的
Select * from
(Select a, b, c from table1 where some condition) as Result1,
(Select d, e from table2 where some another condition) as Result2
一切正常,直到嵌套選擇一個沒有返回值,然後又選擇回報沒有什麼太多的最後選擇。
請告訴我什麼是我的錯?
我有一個這樣的查詢:連接多個記錄的一個記錄PostgreSQL的
Select * from
(Select a, b, c from table1 where some condition) as Result1,
(Select d, e from table2 where some another condition) as Result2
一切正常,直到嵌套選擇一個沒有返回值,然後又選擇回報沒有什麼太多的最後選擇。
請告訴我什麼是我的錯?
按照我上面的評論,下面應該工作,你如何期望:
select
*
from
(select a, b, c from table1 where predicate1) Result1
full outer join
(select d, e from table2 where predicate2) Result2 on
1 = 1
這就是我做的!謝謝 – Highlan
嘗試:
Select (
(Select a, b, c from table1 where some condition) as Result1,
(Select d, e from table2 where some another condition) as Result
)
嘗試內或自加入
發表了一些成績樣本,以更好地瞭解這個問題。
與聚結取代你的SELECT語句或爲空函數,將阻止你扔空值誤差 –
請** [編輯] **你的問題,並添加一些[樣本數據](http://plaintexttools.github.io/plain-text-table/)和基於該數據的預期輸出。 [**格式化文本**](http://stackoverflow.com/help/formatting)請,[**沒有屏幕截圖**](http://meta.stackoverflow.com/questions/285551/why-may -i-不上傳圖像-的代碼上那麼當灰化-A-問題/ 285557#285557)。 ** [**]您的問題 - 請勿**在論壇中發佈代碼或其他信息。 –
@AnkitAgrawal感謝您的評論,可能給我一個示例,我是posgresql中的新成員,我在mysql中加入了這個功能 – Highlan