DB Grants & Synonym.
GRANT PRIVALAGES ON TABLE_NAME TO SCHEMA_NAME
GRANT SELECT ON TABLE_NAME TO SCHEMA_NAME
First Schema Name is target Schema, Second Schema is Actual where table is exists.
CRATE OR REPLACE SYNONYM SCHEMA_NAME.TABLE_NAME FOR SCHEMA_NAME.TABLE_NAME
SQL Query by With Operation and creating cases.
WITH ASSUMED_NAME AS (
SELECT F1, F2, F3
FROM ( SELECT F1, F2, F3
SUM ( CASE
WHEN (F1 IS NOT NULL AND F2 IS NULL )
THEN 1
ELSE 0
END) AS COUNT_FIELD
FROM TABLE_NAME_1 T1
LEFT OUTER JOIN TABLE_NAME_2 T2
ON T1.ID = T2.ID
GROUP BY F1, F2, F3 )
)
SELECT F1, F2, F3 FROM ASSUMED_NAME
UNION ALL
SELECT ' ', ' ', 'TOTAL', SUM(COUNT_FIELD) AS TOTAL FOR ASSUMED_NAME
GRANT PRIVALAGES ON TABLE_NAME TO SCHEMA_NAME
GRANT SELECT ON TABLE_NAME TO SCHEMA_NAME
First Schema Name is target Schema, Second Schema is Actual where table is exists.
CRATE OR REPLACE SYNONYM SCHEMA_NAME.TABLE_NAME FOR SCHEMA_NAME.TABLE_NAME
SQL Query by With Operation and creating cases.
WITH ASSUMED_NAME AS (
SELECT F1, F2, F3
FROM ( SELECT F1, F2, F3
SUM ( CASE
WHEN (F1 IS NOT NULL AND F2 IS NULL )
THEN 1
ELSE 0
END) AS COUNT_FIELD
FROM TABLE_NAME_1 T1
LEFT OUTER JOIN TABLE_NAME_2 T2
ON T1.ID = T2.ID
GROUP BY F1, F2, F3 )
)
SELECT F1, F2, F3 FROM ASSUMED_NAME
UNION ALL
SELECT ' ', ' ', 'TOTAL', SUM(COUNT_FIELD) AS TOTAL FOR ASSUMED_NAME