Ive got this simple table
browser | pageviews |
---|---|
safari | 7.1875 |
ie | 1.935 |
firefix | 1.3445 |
safari | 2.03 |
Im trying to calculate the percentage of the page views out of the total (in millions) for each browser.
with total as
( select sum(pageviews) as total
from pageviews )
select browser,
pageviews / total.total as share
from pageviews,
total
but im receiving this error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'total as ( select sum(pageviews) as total
Any suggestion on how to calculate the percentage? Thanks!