使用postgresql将多条记录连接到一条记录

时间:2017-09-25 07:28:19

标签: postgresql concatenation

我有这样的查询:

    self.Add_GroupD.triggered.connect(lambda checked, index1=4, index2=1 : self.someslot(index1, index2))
def someslot(self, index1, index2)
    self.tabWidget_4.setCurrentIndex(index1)
    self.tabs.setCurrentIndex(index2)

一切都没问题,直到其中一个嵌套选择没有返回任何内容,然后另一个选择在最终选择中也不返回任何内容。

请告诉我我有什么问题?

2 个答案:

答案 0 :(得分:1)

根据我上面的评论,以下内容应符合您的预期:

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

答案 1 :(得分:0)

  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. 发布一些结果样本以更好地了解问题。

相关问题