The error is in the first ORDER BY
which is on the second line. The code runs perfectly fine, if I remove the first ORDER BY
.
Here is the code :
SELECT
dea.continent,
dea.location,
dea.date,
dea.population,
vac.new_vaccinations,
SUM(CAST(vac.new_vaccinations AS BIGINT)) OVER (PARTITION BY dea.location ORDER BY dea.location, dea.date)
FROM
PortfolioProject..CovidDeaths dea
JOIN
PortfolioProject..CovidVaccinations vac ON dea.location = vac.location
AND dea.date = vac.date
WHERE
dea.continent IS NOT NULL
ORDER BY
2,3
Here is the error:
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near 'order'