I have two tables that return results when I put them together using UNION ALL
, like this:
SELECT * FROM TABLE_A
UNION ALL
SELECT * FROM TABLE_A
But for some reason when I add this code into a WITH
clause, like below, it does not work:
WITH
SQ_Union AS
(
SELECT * FROM TABLE_A
UNION ALL
SELECT * FROM TABLE_A
)
SELECT
*
FROM
SQ_Union
When I run that I get the following:
ORA-00918: column ambiguously defined
Both tables have the same columns, name the same, but with differing table names, and data content. Why does this run without the WITH
clause, and not run with it?