I have case statement below as
count(CASE WHEN time_lag / 10000 >= 0 AND time_lag / 1000 <= 50 THEN 1 END) AS [0 - 50]
but am getting error on syntax error, is there proper way to divide in case statement? thanks
Advertisement
Answer
You need to add quotes to the desired column name (if it’s not going to follow traditional naming rules.
Change:
select count(...) AS [0 - 50]
To:
select count(...) AS "[0 - 50]"
Btw, the exact syntax error you got was Syntax error: unexpected '['. (line 7)
. Please make sure to include the exact error you get in future posts.