Drop table if exists #populationpercentagevaccine
創建 Table #populationpercentagevaccine
(
Continent nvarchar(255)。
location nvarchar(255)。
Date Datetime,
人口numeric。
New_vaccinations numeric,
cumulative_vaccine numeric, 累加疫苗numeric.
)
我的表執行得很好,但那段代碼INSERT INTO給了我問題
。Insert into #populationpercentagevaccine
select 死亡.大陸, 死亡.地點, 死亡.日期, 死亡.人口, 疫苗.新疫苗,
sum(convert(int,vaccine.new_vaccinations ) over(partition by death. order by death.location, death.date) as cumulative_all_vaccine
我創建了表并插入到同一個表中,是什么導致了列名或提供的值的數量與表的定義不匹配的問題
。uj5u.com熱心網友回復:
你的表列和插入時提供的列不匹配
。 Insert into #populationpercentagevaccine
select Continent, [location], [Date], [Population], New_vaccinations
, sum(convert(int,new_vaccinations )) over(partition by [location] order by [location, [date] ) as cumulative_all_vaccine
from #populationpercentagevaccine
這是你之前的問題:
這是你之前的問題。
創建 Table #populationpercentagevaccine
(
Continent nvarchar(255)。
location nvarchar(255)。
Date Datetime,
人口numeric。
New_vaccinations numeric,
cumulative_vaccine numeric,
cumulative_all_vaccine numeric, cumulative_vaccine numeric.
)
插入 into #populationpercentagevaccine
select Continent, [location], [Date], [Population], New_vaccinations, cumulative_vaccine --之前缺少這個。
, sum(convert(int,new_vaccinations )) over(partition by [ location]
order by [location, [date]) as cumulative_all_vaccine
from #populationpercentagevaccine
uj5u.com熱心網友回復:
你的表有7列,你的查詢只提供了其中6列的值。 要么提供值,要么插入身份資訊
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/311071.html
標籤:
上一篇:SQL-選擇計數最高的國家
下一篇:在SQL服務器上使用案例時
