Reputation:
Put simply, I want to select all data in two columns from each of six tables using one query. All six tables have these same two columns. They aren't relational tables and so there is no need to relationally join them.
The obvious (but apparently wrong) way to do it would be:
select col1, col2 from table1, table2, (... etc)
However this gives a "ORA-00918: column ambiguously defined" error. I've tried a variety of other things including some rather poor sub-querying but haven't managed to get any workable results. Any suggestions for how to do this? Thanks.
Upvotes: 1
Views: 937
Reputation: 231651
My guess is that you're looking for something like
SELECT col1, col2 FROM table1
UNION ALL
SELECT col1, col2 FROM table2
UNION ALL
...
SELECT col1, col2 FROM table6
If that's not what you want, it would be helpful if you could post some sample data and the expected output.
Upvotes: 5