目前,我的数据返回以下内容:
invoice_no rejected_dt cleared_rejections_dt
1000 2020-10-15 NULL
1000 NULL 2020-10-17
1200 2020-10-20 NULL
1400 2020-10-25 NULL
1200 NULL 2020-10-31
我想要这样的东西:
invoice_no rejected_dt cleared_rejections_dt
1000 2020-10-15 2020-10-17
1200 2020-10-20 2020-10-31
1400 2020-10-25 NULL
我玩过枢轴,但是以前的所有值都是聚合函数,如何用日期呢?
您需要聚合功能并分组
select invoice_no, max( rejected_dt), max(cleared_rejections_dt)
from my_table
group by invoice_no
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句