为什么会出现双倍的列名呢(ORACAL数据库) 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 |
最佳回答 |
||||
1
|
|