0

I have been trying to run this query in order to get a rolling count of people vaccinated in different locations but have been receiving a syntax error and I am not sure what to do

Here's the query;

SELECT 
    dea.continent,
    dea.location,
    dea.date,
    dea.population,
    vac.new_vaccinations,
    SUM(CONVERT(INT, vac.new_vaccinations)), OVER (PARTITION BY dea.location order by dea.location, dea.date)as RollingCountPeopleVaccinated
    FROM  
    CovidDeaths dea
    JOIN CovidVaccinations vac
      ON 
     dea.location= vac.location and
     dea.date= vac.date
     where dea.continent is not null
    ORDER BY
    1,2,3

and the result:

Execution finished with errors. Result: near "BY": syntax error At line 161:

SELECT 
    dear.continent,
    dea.location,
    dea.date,
    dea.population,
    vac.new_vaccinations,
    SUM(CONVERT(INT, vac.new_vaccinations)), OVER (PARTITION BY

What does this error mean?

Bohemian
  • 412,405
  • 93
  • 575
  • 722
Pamela
  • 7
  • 1
  • 2
    Try removing the comma before `OVER`. Also, location in `ORDER BY` may be redundant since you use it as partition column. – Parfait Dec 29 '22 at 00:08
  • Are you sure that you use MySQL? Your code and error message looks like ones specific for MS SQL (SQL Server).. what is the output for `select version();`? – Akina Dec 29 '22 at 04:55
  • Hi it is DB BROWSER(SQLite) – Pamela Dec 29 '22 at 16:16

0 Answers0