我创建了两个临时表来连接它们。
create temporary table if not exists dbo.t1 as
(select * from dbo.cp where id%2=1);
create temporary table if not exists dbo.t2 as
(select * from dbo.cp where id%2=0);
在临时表中有两列:查询时
select * from dbo.t1;
这张table上来了。
codes id
123 1
213 2
144 3
423 4
我的问题是:当我说查询时
select codes from dbo.t1;
我得到一个错误: unknown column 'codes' in fieldlist.
当我询问
select 'codes` from dbo.t1
我得到输出
codes id
codes 1
codes 2
codes 3
codes 4
当我询问
select `codes` from dbo.t1
我得到输出 unknown column in field list
.
这是一个很大的问题,因为当我尝试这些不同的查询来执行内部连接时,我没有得到正确的输出:
Create Table edit AS
(select
't1.codes',
t1.id t1_id, t2.*
from t2
inner join t1 on t1.id = t2.id - 1);
Create Table edit AS
(select
t1.codes t1_codes,
t1.id t1_id, t2.*
from t2
inner join t1 on t1.id = t2.id - 1);
Create Table edit AS
(select
t1*, t2.*
from t2
inner join t1 on t1.id = t2.id - 1);
问题是我得到了 "duplicate column name codes"
2条答案
按热度按时间0ve6wy6x1#
勾号而不是引号
polhcujo2#
尝试用反勾号(`)符号 Package 代码