连接多个记录的一个记录PostgreSQL的

问题描述:

我有一个这样的查询:连接多个记录的一个记录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 

一切正常,直到嵌套选择一个没有返回值,然后又选择回报没有什么太多的最后选择。

请告诉我什么是我的错?

+0

与聚结取代你的SELECT语句或为空函数,将阻止你扔空值误差 –

+1

请** [编辑] **你的问题,并添加一些[样本数据](http://plaintexttools.github.io/plain-text-table/)和基于该数据的预期输出。 [**格式化文本**](http://*.com/help/formatting)请,[**没有屏幕截图**](http://meta.*.com/questions/285551/why-may -i-不上传图像-的代码上那么当灰化-A-问题/ 285557#285557)。 ** [**]您的问题 - 请勿**在论坛中发布代码或其他信息。 –

+0

@AnkitAgrawal感谢您的评论,可能给我一个示例,我是posgresql中的新成员,我在mysql中加入了这个功能 – Highlan

按照我上面的评论,下面应该工作,你如何期望:

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 
+0

这就是我做的!谢谢 – Highlan

  1. 尝试:

    Select (
        (Select a, b, c from table1 where some condition) as Result1, 
        (Select d, e from table2 where some another condition) as Result 
    ) 
    
  2. 尝试内或自加入

  3. 发表了一些成绩样本,以更好地了解这个问题。