数据集问题

为什么会出现双倍的列名呢(ORACAL数据库)

image.png

image.png

SELECT '当日' as types,a.xmthdlx,count(1) as n FROM

(select

requestid,

czrq,

jxs,

czmc,

case when hdlx = '1' then '车展' else to_char(hdlx) end as hdlx,

case when xmthdlx = '1' then '小红书'

when xmthdlx = '0' then '抖音'

else to_char(xmthdlx) end as xmthdlx

from formtable_main_40

where czrq = '${dates}') a

INNER JOIN 

(

select requestid,workflowid,status from workflow_requestbase

where 1=1

-- and (status = '出口7' or status = '结束')

and (workflowid = 3022 OR workflowid = 42022) ) b

ON a.requestid = b.requestid

group by a.xmthdlx

union ALL

SELECT '当月' as types,a.xmthdlx,count(1) as n FROM

(select

requestid,

czrq,

jxs,

czmc,

case when hdlx = '1' then '车展' else to_char(hdlx) end as hdlx,

case when xmthdlx = '1' then '小红书'

when xmthdlx = '0' then '抖音'

when xmthdlx = '2' then '微信'

else to_char(xmthdlx) end as xmthdlx

from formtable_main_40

where czrq >=  to_char(TO_DATE('${dates}','YYYY-MM-DD'),'yyyy-mm-')||'01') a

INNER JOIN 

(

select requestid,workflowid,status from workflow_requestbase

where 1=1

-- and (status = '出口7' or status = '结束')

and ( workflowid = 3022  OR workflowid = 42022) 

) b

ON a.requestid = b.requestid

group by a.xmthdlx

union ALL

SELECT '累计' as types,a.xmthdlx,count(1) as n FROM

(select

requestid,

czrq,

jxs,

czmc,

case when hdlx = '1' then '车展' else to_char(hdlx) end as hdlx,

case when xmthdlx = '1' then '小红书'

when xmthdlx = '0' then '抖音'

when xmthdlx = '2' then '微信'

else to_char(xmthdlx) end as xmthdlx

from formtable_main_40

-- where czrq >=  to_char(TO_DATE('${dates}','YYYY-MM-DD'),'yyyy-mm-')||'01'

) a

INNER JOIN 

(

select requestid,workflowid,status from workflow_requestbase

where 1=1

-- and (status = '出口7' or status = '结束')

and ( workflowid = 3022  OR workflowid = 42022) 

) b

ON a.requestid = b.requestid

group by a.xmthdlx

FineReport ZxxT 发布于 2022-9-1 10:23 (编辑于 2022-9-1 10:24)
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共1回答
最佳回答
1
snrtuemcLv8专家互助
发布于2022-9-1 10:25

你这个是卡了,重启设计器看看

你查询数据是对,正常同样列名会报错的

  • 2关注人数
  • 231浏览人数
  • 最后回答于:2022-9-1 10:25
    请选择关闭问题的原因
    确定 取消
    返回顶部