7. Product Sum 2 "/" placement issues


#1

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;


7. Product Sum 2
Advanced Aggregates. Exercice number7(Prodcut Sum2
#2

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

[operator] \n

but not,

\n
[operator]

#3

Thanks you mate. It works.