7. Product Sum 2 "/" placement issues

After playing around a bit I noticed that the code will not work when the β€œ/” is at the beginning on the 2nd line, but it functions fine at the end of the first line. Why is this?

Here is the code for clarity:

select name, round(sum(amount_paid) /
(select sum(amount_paid) from order_items) * 100.0, 2) as pct
from order_items
group by 1
order by 2 desc;

1 Like

I can’t say for sure, but speculating it may be that the parser allows,

[operator] \n

but not,

\n
[operator]

Thanks you mate. It works.