【发布时间】:2021-11-06 23:40:40
【问题描述】:
Drop table if exists #populationpercentagevaccine
Create Table #populationpercentagevaccine
(
Continent nvarchar(255),
location nvarchar(255),
Date Datetime,
Population numeric,
New_vaccinations numeric,
cumulative_vaccine numeric
)
我的表执行得很完美,但是代码 INSERT INTO 给我带来了问题
Insert into #populationpercentagevaccine
select death.Continent, death.location, death.Date, death.Population, vaccine.New_vaccinations,
sum(convert(int,vaccine.new_vaccinations )) over(partition by death.location order by death.location, death.date) as cumulative_all_vaccine
我创建了表并插入到同一个表中导致列名或提供的值的数量与表定义不匹配该问题
【问题讨论】:
-
您的插入语句中缺少 cumulative_vaccine。我刚刚添加了该列。 @AshishYadav。表中的列数与插入语句不匹配。而且您的查询也没有 from 子句和 join s
-
我试过了,但没用,我有完整的连接子句查询
-
如果您可以添加我可以检查的完整查询。添加了示例答案。我用了你给的桌子
-
您刚刚编辑了问题。
-
我实际上仍然看到旧查询
标签: sql sql-server tsql sql-server-2008 sql-insert