Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SQL交叉联接查询不使用变量_Sql_Sql Server_Variables_Cross Join - Fatal编程技术网

SQL交叉联接查询不使用变量

SQL交叉联接查询不使用变量,sql,sql-server,variables,cross-join,Sql,Sql Server,Variables,Cross Join,此交叉连接工作正常: select * from x, y 我正在尝试运行此查询: select abc.col1 from abc (select * from x, y) abc 但我得到了这个错误信息: Msg 8156, Level 16, State 1, Line 2 The column 'col1' was specified multiple times for 'abc'. 表x和表y具有相同的列和列定义 有什么想法/建议吗 select abc.col1 from a

此交叉连接工作正常:

select * from x, y
我正在尝试运行此查询:

select abc.col1 from abc
(select * from x, y) abc
但我得到了这个错误信息:

Msg 8156, Level 16, State 1, Line 2
The column 'col1' was specified multiple times for 'abc'.
表x和表y具有相同的列和列定义

有什么想法/建议吗

select abc.col1 from abc
(select * from x, y) abc
您正在对两个同名的表使用别名。尝试:

select abc.col1 from abc,
(select x.* from x, y) abc2
您正在对两个同名的表使用别名。尝试:

select abc.col1 from abc,
(select x.* from x, y) abc2
您正在对两个同名的表使用别名。尝试:

select abc.col1 from abc,
(select x.* from x, y) abc2
您正在对两个同名的表使用别名。尝试:

select abc.col1 from abc,
(select x.* from x, y) abc2

除了Lock的答案,您还忘记了逗号:

select 
    abc.col1 
from abc, (select * from x, y) abc2
更好的是,使用ansi 1992符号:

select 
    abc.col1 
from abc CROSS JOIN (select * from x, y) abc2

除了Lock的答案,您还忘记了逗号:

select 
    abc.col1 
from abc, (select * from x, y) abc2
更好的是,使用ansi 1992符号:

select 
    abc.col1 
from abc CROSS JOIN (select * from x, y) abc2

除了Lock的答案,您还忘记了逗号:

select 
    abc.col1 
from abc, (select * from x, y) abc2
更好的是,使用ansi 1992符号:

select 
    abc.col1 
from abc CROSS JOIN (select * from x, y) abc2

除了Lock的答案,您还忘记了逗号:

select 
    abc.col1 
from abc, (select * from x, y) abc2
更好的是,使用ansi 1992符号:

select 
    abc.col1 
from abc CROSS JOIN (select * from x, y) abc2

您必须在内部查询节中指定列名。 大概是这样的:

select abc.col1 from abc
(select x.col1,y.col1 from x, y) abc 

您必须在内部查询节中指定列名。 大概是这样的:

select abc.col1 from abc
(select x.col1,y.col1 from x, y) abc 

您必须在内部查询节中指定列名。 大概是这样的:

select abc.col1 from abc
(select x.col1,y.col1 from x, y) abc 

您必须在内部查询节中指定列名。 大概是这样的:

select abc.col1 from abc
(select x.col1,y.col1 from x, y) abc 

谢谢你的回答。我试图将select*from x,y作为变量abc,然后在select语句中使用该变量select abc.col1 from abcAre表x和y中是否有同名的列?如果是这样,则需要使用表名作为前缀,例如从x,y中选择x.*。请看我的更新。谢谢你的回答。我试图将select*from x,y作为变量abc,然后在select语句中使用该变量select abc.col1 from abcAre表x和y中是否有同名的列?如果是这样,则需要使用表名作为前缀,例如从x,y中选择x.*。请看我的更新。谢谢你的回答。我试图将select*from x,y作为变量abc,然后在select语句中使用该变量select abc.col1 from abcAre表x和y中是否有同名的列?如果是这样,则需要使用表名作为前缀,例如从x,y中选择x.*。请看我的更新。谢谢你的回答。我试图将select*from x,y作为变量abc,然后在select语句中使用该变量select abc.col1 from abcAre表x和y中是否有同名的列?如果是这样,则需要使用表名作为前缀,例如从x,y中选择x.*。查看我的更新。