最新问题 是最后的语句对了  但是前面的as值没有更改

select 

a.manage_unit    as 区分, round(a.IHGU,4) as IHGU,  round(a.OTT,4) as OTT,  round(b.tousu_timely,4) as 投诉处理及时率, round(c.work_timely,4) as 新装投诉率,

round(d.work_rate,4)  as 安装成功率

from  

 MONTH_BOX_TIMELY A,

 TOUSU_DEL_TIMELY B,

 TOUSU_WORK_TIMELY C,

 WORK_SUCCEED_RATE D

 where  a.manage_unit=b.manage_unit  and  b.manage_unit=c.manage_unit  and  c.manage_unit=d.manage_unit

and  a.manage_unit='浦东'


image.png

image.png

不知道应该怎么在select中  将这个表给它转置,希望哪位大神可以指点一二!!!小生万分感谢



select manage_unit as IHGU, round(IHGU,4)  from  MONTH_BOX_TIMELY   where manage_unit='浦东'

union all 

select manage_unit as OTT, round(OTT,4)  from  MONTH_BOX_TIMELY   where manage_unit='浦东'

union all 

select manage_unit as 投诉处理及时率, round(tousu_timely,4)from  TOUSU_DEL_TIMELY where manage_unit='浦东'

union all 

select manage_unit as 新装投诉率, round(work_timely,4)from   TOUSU_WORK_TIMELY  where manage_unit='浦东'

union all 

select manage_unit as 安装成功率, round(work_rate,4)from   WORK_SUCCEED_RATE  where manage_unit='浦东'

image.png

Elison_man 发布于 2019-11-12 10:38 (编辑于 2019-11-12 11:27)
1min目标场景问卷 立即参与
回答问题
悬赏:4 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共4回答
最佳回答
0
张洪威Lv6高级互助
发布于2019-11-12 10:41

类似这种,用union all 简单拼接下。

select 'IHGU' as '区分', round(a.IHGU,4) as '西区' from 表

union all 

select 'OTT' as '区分', round(a.OTT,4) as '西区' from 表

  • Elison_man Elison_man(提问者) 我按照你的方式更新了一下 大致出来了 但是还有一个小问题 麻烦您给解决一下 ,我把图贴到上面吧
    2019-11-12 11:26 
  • Elison_man Elison_man(提问者) select \'IHGU\', round(IHGU,4) from MONTH_BOX_TIMELY where manage_unit=\'浦东\' union all select \'OTT\', round(OTT,4) from MONTH_BOX_TIMELY where manage_unit=\'浦东\' union all select \'投诉处理及时率\', round(tousu_timely,4)from TOUSU_DEL_TIMELY where manage_unit=\'浦东\' union all select \'新装投诉率\', round(work_timely,4)from TOUSU_WORK_TIMELY where manage_unit=\'浦东\' union all select \'安装成功率\', round(work_rate,4)from WORK_SUCCEED_RATE where manage_unit=\'浦东\'
    2019-11-12 11:42 
  • Elison_man Elison_man(提问者) 好了 谢谢您了
    2019-11-12 11:42 
  • free_zz free_zz 回复 Elison_man(提问者) 新弄一列,就取你想要的名字
    2019-11-12 11:44 
最佳回答
0
孤陌Lv6资深互助
发布于2019-11-12 10:44

不懂  这个报表 不是可以做了吗   还要怎么转换?

最佳回答
0
JackloveLv7高级互助
发布于2019-11-12 10:48

用1楼的方法吧各个字段取出来 在union all 一下就好了

最佳回答
0
wengleiLv4初级互助
发布于2019-11-12 10:55

(⊙o⊙)…,可以使用kettle工具的行转列,应该比较方便一些

  • 5关注人数
  • 377浏览人数
  • 最后回答于:2019-11-12 11:27
    请选择关闭问题的原因
    确定 取消
    返回顶部