我正在创建一个查询以获取数据以生成报告,我下面有两个查询,一个是获取“ ser”数据,另一个查询是获取“ qy”数据。我需要将以下查询合并为一个查询,并且 我的表bat_irt中有一列“ update_date”。 我需要在合并查询中获取最后一个“ update_date”减去第一个update_date 我是DB的新手,不知道如何做。请对此提供帮助。
update_date列具有以下格式的数据:
19年6月18日
select * from bat_irt a
where a.create_date >=sysdate-15
and a.process_flag='I'
and ser is not null
and not exists (select 'x' from bat_irt b
where a.id = b.id
and a.no=b.no
and a.ser=b.ser
and a.proces_flag = 'y');
-获取服务日期
select * from bat_irt a
where a.create_date >=sysdate-15
and a.process_flag='I'
and qy is not null
and not exists (select 'x' from bat_irt b
where a.id = b.id
and a.no=b.no
and a.ser=b.ser
and a.proces_flag = 'y');
-确认日期
预先感谢