我在将查询结果的所有行合并到一行时遇到问题。
这是我成绩的总结
Column1 Column2 Column3 Column4 1900200196 Null 1900200196 Null 1900200196 Null Intake and assmnt/eva 1900200196 Null Staff interpreter 1900200196 INTERPRETER 1900200196 Null
我希望我的结果看起来像这样
Column1 Column2 Column3 Column4 1900200196 MEDICAL INTERPRETER Staff interpreter Intake and assmnt/eval
在正确方向上的任何帮助都可以。
答案 0 :(得分:3)
select column1,
max(column2) as column2,
max(column3) as column3,
max(column4) as column4
from your_table
group by column1
答案 1 :(得分:2)
好像您要聚合:
with A as ( select 1900200196 as column1, null as column2, 'INTERPRETER' as column3, 'foo' as column4 FROM DUAL UNION select 1900200196, 'M', null, null FROM DUAL ) SELECT column1, MAX(column2) column2, MAX(column3) column3, MAX(column4) column4 FROM A GROUP BY column1
COLUMN1 | COLUMN2 | COLUMN3 | COLUMN4 ---------: | :------ | :---------- | :------ 1900200196 | M | INTERPRETER | foo
db <>提琴here