合并单个表中的行



>我有一个看起来像这样的表格:

abs0| rel0 | abs1 | rel1
=========================
60  | 0.6  | NULL | NULL 
NULL| NULL |  40  |  0.4

并希望它看起来像这样:

abs0| rel0 | abs1 | rel1
=========================
60  | 0.6  |  40  |  0.4

*此问题已解决

你可以对 elide null 使用聚合函数,例如::

select min(abs0) as abs0, min(rel0) as rel0, min(abs1) as abs1, min(rel1) as rel1
from my_table 

您可以使用max .

SELECT max(c1) AS c1
    ,max(c2) AS c2
    ,max(c3) AS c3
    ,max(c4) AS c4
FROM t1;

结果:

C1   C2     C3   C4
--------------------
60   0.60   40   0.40

您可以在此处查看演示

最新更新