Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Incorrect syntax near 'cast', expected 'AS'- SQL Project

I am watching this video from Alex Freburg: https://www.youtube.com/watch?v=qfyynHBFOsM.

At 33.43 mins he has done some code on the server, the exact I have copied but I get this error message:

Incorrect syntax near ‘CAST’, expected ‘AS’

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The code I have tried to run is this:

Select location, MAX(CAST(total_deaths) AS int)) AS TotalDeathCount
From [Portfolio Project]..CovidDeaths$
group by location
order by TotalDeathCount desc

Any help would be appreciated.

I tried a variety of things but not sure why it is not working like the video above.

>Solution :

There’s an extra closing right paren ())

MAX(CAST(total_deaths) AS int)) 

should be

MAX(CAST(total_deaths AS int)) 
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading