Could't Pass 9.2


#1

I am stuck at 9.2, whenever I hit run button, it shows error "Group by the category" and browser crashed. Below is my code, can anyone help? Thank you

select *,
case name
when 'kale-smoothie' then 'smoothie'
when 'banana-smoothie' then 'smoothie'
when 'orange-juice' then 'drink'
when 'soda' then 'drink'
when 'blt' then 'sandwich'
when 'grilled-cheese' then 'sandwich'
when 'tikka-masala' then 'dinner'
when 'chicken-parm' then 'dinner'
else 'other'
end as category, round(1.0 * sum(amount_paid) /
(select sum(amount_paid) from order_items) * 100, 2) as pct
from order_items
group by 1
order by 2 desc;

I basically just replaced /**/ with sum(amount_paid)


#2

Make sure that indentations and spacing is exactly the same as given in the query on the left of the page. I had the same problem and fixed it by copying the query and replacing only /**/.


#3

Also trying to type the things around /**/ in the same line like ->
end as category, round(1.0 * sum(amount_paid) /
(select sum(amount_paid) from order_items) * 100, 2)
sometimes is just the way you write it and not about the code


#4

Try not including the * and , charactes in the first line, the rest is fine. That is what worked for me