It looks like you want a "crosstab" or "pivot" query. See the tablefunc module for some functions that'll help with that, and search Stack Overflow for [postgresql] crosstab
or [postgresql] pivot
.
SQL does not permit you to use column-references as column-aliases like you wrote above. It's not valid syntax and there'd be some logical problems with making it work.