我有来自查询的输出:
Select hostname,support1,support2 From hostnames where hostname in ('C')
C | NULL | NULL
C | NULL | B
C | A | NULL
C | A | B
如您所见,有NULL | B
和A | NULL
。
我需要输出:
C | A | B
(将两行合并为一行) 这该怎么做 ? 感谢
答案 0 :(得分:1)
您可以使用聚合:
Select hostname, max(support1) as support1, max(support2) as support2
From hostnames
where hostname in ('C')
group by hostname;