分类
life

mysql ELT 替换返回的列

统计数量的时候,select 返回值是

1 | 138
2 | 234
3 | 22
4 | 348

想要把最前面的代号换成有意义的字符串

select
  ELT(app_code, "dev", "demo", "demo1", "prod") as env,
  count(*)
from
  app_overview
where
  last_deployed_tag != ""
group by
  app_code;

结果为

dev   | 138
demo  | 234
demo1 | 22
prod  | 348

发表评论

电子邮件地址不会被公开。 必填项已用*标注