我正在测试几个表中的最新日期在 oracle 中都相互匹配。我想出的 SQL 看起来像:
select ICEAG.process_month
from (
select *
from (
select process_month
from TABLE1
group by process_month
order by process_month desc
)
where rownum <=1
) ICEAG
join (
select *
from (
select process_month
from TABLETWO
group by process_month
order by process_month desc
)
where rownum <=1
) GAI on (ICEAG.process_month = GAI.process_month)
这可行,但我需要检查大约 12 个表。我应该继续加入更多的子查询,还是有更好的方法?