表A
id f1 f2
123 aa null
123 null bb
234 null cc
234 aa
合并为
id f1 f2
123 aa bb
234 aa cc
------解决方案--------------------
- SQL code
select id,max(f1) as f1,max(f2) as f2 from A group by id
select id,max(f1) as f1,max(f2) as f2 from A group by id