Dynamic column alias based on column value

后端 未结 3 1115
时光说笑
时光说笑 2020-12-11 12:42

I want to name the column alias based on the column value in mysql. Is that possible?

Something like this;

select  
  case when answer_type = \'RB\'          


        
3条回答
  •  南笙
    南笙 (楼主)
    2020-12-11 13:00

    No, that's not possible in pure SQL. You'll probably have to query the data out and then process it in whatever application is executing the query.

提交回复
热议问题