Reputation: 539
I am new to PostgreSQL and trying the below two scenarios:
case
on same column along with index
Select Road/Highway,
case
when index(upcase(Road/Highway), 'xturn') > 0 then 2
else 0
end as preferred_road
from abc_data;
But I am getting syntax error near index and for slash it is only taking Road.
Upvotes: 0
Views: 2468
Reputation: 146030
Generally /
means "division", so your column name is non-standard, much like working with keyword column names, column names with special characters must be quoted with double quotes. Use "Road/Highway"
when referring to the column.
Upvotes: 2