I have been tasked with converting an old reports program to Oracle reports and I came to a halt when I needed to join two queries to make the report work. I'm not new to SQL, but I do need help on this one.
For Oracle Reports 11g, reports needs to show the results of the following two queries, therefore, these queries need to be joined together in one single SQL query for the report to work.
First query:
select table_name
, to_char(load_date, 'MM/DD/ YYYY') as XDATE
, to_char(number_name) as NUMBER NAME
, round(sysdate-load_date) as DAYS
, 'E' AS TABLEIND
from error_table
where load_date is not null
and round(sysdate-load_date) > 15
and number_name not in
(select number_name
from table_comments)
order by table_name
Second query:
select table_name
, to_char(load_date, 'MM/DD/ YYYY') as XDATE
, to_char(number_name) as NUMBER NAME
, round(sysdate-load_date) as DAYS
, 'O' AS TABLEIND
from other_table
where load_date is not null
and round(sysdate-load_date) > 15
and number_name not in
(select number_name
from table_comments)
order by table_name
The results of these two queries should show the results of these two queries with the first query first, and the second query second. Any help with this problem is highly appreciated.