I’m testing that the latest date in several tables all match each other in oracle. The SQL I came up with looks like:
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)
This works but I need to check about 12 tables. Should I just keep joining more subqueries, or is there a better way?
When result is > 1, then one of the tables has different last process_month.