Why is BigQuery Sandbox saying its ERROR: Expected keyword AS but got "(" at [1:

  • Is this an issue with BigQuerry. I was follwing along with this youtube video and for some reason this code will not work.

     

    ///

    with pop_vs_vac (continent, location, date, population, new_vaccinations, rolling_people_vaccinated) as (

    Select dea.continent, dea.location, dea.date, dea.population, vac.new_vaccinations, SUM(CASt(vac.new_vaccinations as int)) OVER (partition by dea.location order by dea.location, dea.date) as rolling_peoploe_vaccinated --(rollling_people_vaccinated/population)* 100

    from [gg-analytics-404715.Portfolio_Covid.Covid_Deaths] as dea

    join [gg-analytics-404715.Portfolio_Covid.Covid_vaccinations] as vac

    on dea.location = vac.location

    and dea.date = vac.date

    where dea.continent is not null

    --- order by 1, 2, 3

    )

    select *

    from pop_vs_vac

    ///

  • Best guess - BigQuery is not expecting a column list in your CTE. BUT BigQuery is NOT the same thing as SQL Server 2022... You will likely get better results in a BigQuery forum than a SQL Server forum.

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply