ziggy ziggy - 2 years ago 150
SQL Question

SQLite Case Statement

All the values in the orders table are there and are integers. I am not sure what I am doing wrong syntax wise. it keeps giving me this error

near "range": syntax error:

when AMOUNT < 2000 then "low price"
when amount between 3000 and 2000 then "medium price"
else "high price"
end as price range,
from orders
group by 1;

Answer Source

If you want spaces in names then use backticks

as `price range`
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download