create table #PercentofPopulationVaccinated
(
continent nvarchar(255),
location nvarchar(255),
date datetime,
Population numeric,
people_fully_vaccinated numeric,
[%_of_pop_vaxxxed] numeric,
rn int
)
insert into #PercentofPopulationVaccinated
select
cd.continent, cd.location, cd.date, cd.population,
vac.people_fully_vaccinated,
(cast(vac.people_fully_vaccinated as int) / cd.population) * 100 as [%_of_pop_vaxxxed],
rn = row_number() over (partition by cd.Location order by (vac.people_fully_vaccinated / cd.population) * 100 desc, cd.Date)
from
coviddeaths as cd
join
covidvaccinations vac on cd.location = vac.location
and cd.date = vac.date
where
cd.continent is not null
select *
from #PercentofPopulationVaccinated
Error
Column name or number of supplied values does not match table definition
This error is odd; I'm sure it has to do with row number
1条答案
按热度按时间lsmepo6l1#
First if that is your temporary table, you should first check if that table exist and drop it.
After that table definition should be:
and your select: