我有一个查询,我正在尝试组合但使用不同的列。具体情况如下:
这就是我想要做的事情:它运行但它没有加入两列。它们将被输出到DBVisualizer
中的单独结果选项卡中 Select count (distinct CODE) AS Comp_PCT
from cons.GM
Where POLICY='NR'
And PCT is null
UNION
Select count (distinct CODE) AS Comp_DTY
from cons.GM
Where POLICY='NR'
And DTY is null
答案 0 :(得分:0)
我不知道这个答案是正确的形式:
SELECT
(Select count (distinct CODE)
from cons.GM
Where POLICY='NR'
And PCT is null) AS Comp_PCT,
(Select count (distinct CODE)
from cons.GM
Where POLICY='NR'
And DTY is null) AS Comp_DTY