select abc.col1 from abc
(select * from x, y) abc
You are aliasing two tables with the same name. Try:
select abc.col1 from abc,
(select x.* from x, y) abc2
문제
This cross join works fine:
select * from x, y
I am trying to run this query:
select abc.col1 from abc
(select * from x, y) abc
But I get this error message:
Msg 8156, Level 16, State 1, Line 2
The column 'col1' was specified multiple times for 'abc'.
Both tables x and y have the same columns and column definitions.
Any ideas/suggestions?
해결책
select abc.col1 from abc
(select * from x, y) abc
You are aliasing two tables with the same name. Try:
select abc.col1 from abc,
(select x.* from x, y) abc2
다른 팁
you have to specify column name in inner query section. something like this:
select abc.col1 from abc
(select x.col1,y.col1 from x, y) abc
In addition to Lock's answer, you also forgot the comma:
select
abc.col1
from abc, (select * from x, y) abc2
Even better, using the ansi 1992 notation:
select
abc.col1
from abc CROSS JOIN (select * from x, y) abc2