请问如何给这个地方命名

image.png想将这个地方命名为类型,但是不知道怎么改,代码如下

select

'本月',a.值

from 

(

select by_income as  值 from app_db.zhy_fyyw_xl_m_hy

where calmonth = translate(substr(current_date() , 1 ,7 ),'-','')

) as a

union

select

'上月',a.值

from 

(

select sy_income as  值 from app_db.zhy_fyyw_xl_m_hy

where calmonth = translate(substr(current_date() , 1 ,7 ),'-','')

) as a

union

select

'同期',a.值

from 

(

select tq_income as  值 from app_db.zhy_fyyw_xl_m_hy

where calmonth = translate(substr(current_date() , 1 ,7 ),'-','')

) as a

union

select

'同比',a.值

from 

(

select tb_income_rate as  值 from app_db.zhy_fyyw_xl_m_hy

where calmonth = translate(substr(current_date() , 1 ,7 ),'-','')

) as a

union

select

'环比',a.值

from 

(

select hb_income_rate as  值 from app_db.zhy_fyyw_xl_m_hy

where calmonth = translate(substr(current_date() , 1 ,7 ),'-','')

) as a

FineReport 用户x076327 发布于 2022-5-16 11:28
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共2回答
最佳回答
1
Z4u3z1Lv6专家互助
发布于2022-5-16 11:29(编辑于 2022-5-16 11:30)

用个as

image.png

select

'本月' AS '三生三世',a.值

from 

(

select by_income as  值 from app_db.zhy_fyyw_xl_m_hy

where calmonth = translate(substr(current_date() , 1 ,7 ),'-','')

) as a

union

select

'上月',a.值

from 

(

select sy_income as  值 from app_db.zhy_fyyw_xl_m_hy

where calmonth = translate(substr(current_date() , 1 ,7 ),'-','')

) as a

union

select

'同期',a.值

from 

(

select tq_income as  值 from app_db.zhy_fyyw_xl_m_hy

where calmonth = translate(substr(current_date() , 1 ,7 ),'-','')

) as a

union

select

'同比',a.值

from 

(

select tb_income_rate as  值 from app_db.zhy_fyyw_xl_m_hy

where calmonth = translate(substr(current_date() , 1 ,7 ),'-','')

) as a

union

select

'环比',a.值

from 

(

select hb_income_rate as  值 from app_db.zhy_fyyw_xl_m_hy

where calmonth = translate(substr(current_date() , 1 ,7 ),'-','')

) as a

最佳回答
0
霜凡Lv5中级互助
发布于2022-5-16 11:35(编辑于 2022-5-16 11:35)

--

  • 2关注人数
  • 248浏览人数
  • 最后回答于:2022-5-16 11:35
    请选择关闭问题的原因
    确定 取消
    返回顶部