I have this column:
floor
---------
dep:first
dep:second
dep:third
dep:fourth
And I want to make it like this :
DEP
------
first
second
third
fourth
I am trying this :
select
max(case when floor = 'dep:first' then 'first' end) DEP,
max(case when floor = 'dep:second' then 'second' end) DEP,
max(case when floor = 'dep:third' then 'third' end) DEP,
max(case when floor = 'dep:fourth' then 'fourth' end) DEP,
from
db.table
But the result returns the DEP column 4 times:
DEP |DEP |DEP |DEP |
-------|-------|--------|-------|
first |second |third |fourth |