同环比数据错位问题
0
大家好,当我做同环比的时候出现数据移位的问题,如果知道的恳请指导一下吧!万分感激
如图与SQL
-------------------- SQL Request, logical request hash:
4789a0a
SET VARIABLE QUERY_SRC_CD='Report';SELECT
0 s_0,
"YSALES"."YTIME"."YEAR" s_1,
"YSALES"."YSALES#1"."SALES" s_2,
"YSALES"."YSALES#1"."年度销售同比" s_3
FROM "YSALES"
ORDER BY 1, 2 ASC NULLS LAST
FETCH FIRST 65001 ROWS ONLY
[2014-05-07T10:56:36.000+08:00] [OracleBIServerComponent] [TRACE:2] [USER-18] [] [ecid: 210b3929a73d7c0f:-4b125421:145d440c3de:-8000-0000000000001e3f,0:1:9:5] [tid: 1ce8] [requestid: 26f40010] [sessionid: 26f40000] [username: weblogic] -------------------- Sending query to database named orcl (id: <<32575>>), connection pool named 连接池, logical request hash 4789a0a, physical request hash ed56f113: [[
WITH
OBICOMMON0 AS (select T55.ID as c2,
T55.YEAR as c3,
ROW_NUMBER() OVER (PARTITION BY T55.YEAR ORDER BY T55.YEAR DESC) as c4
from
YTIME T55),
SAWITH0 AS (select Case when case D1.c4 when 1 then D1.c2 else NULL end is not null then Rank() OVER ( ORDER BY case D1.c4 when 1 then D1.c2 else NULL end ASC NULLS LAST ) end as c1,
D1.c2 as c2,
D1.c3 as c3
from
OBICOMMON0 D1),
SAWITH1 AS (select min(D1.c1) over (partition by D1.c3) as c1,
D1.c2 as c2
from
SAWITH0 D1),
SAWITH2 AS (select distinct D1.c1 + 1 as c1,
D1.c2 as c2
from
SAWITH1 D1),
SAWITH3 AS (select Case when case D1.c4 when 1 then D1.c2 else NULL end is not null then Rank() OVER ( ORDER BY case D1.c4 when 1 then D1.c2 else NULL end ASC NULLS LAST ) end as c1,
D1.c3 as c2
from
OBICOMMON0 D1),
SAWITH4 AS (select distinct min(D1.c1) over (partition by D1.c2) as c1,
D1.c2 as c2
from
SAWITH3 D1)
select sum(T52.SALES) as c1,
D3.c2 as c2
from
YSALES T52,
SAWITH2 D5,
SAWITH4 D3
where ( T52.ID = D5.c2 and D3.c1 = D5.c1 )
group by D3.c2
order by c2
]]
[2014-05-07T10:56:36.000+08:00] [OracleBIServerComponent] [TRACE:2] [USER-18] [] [ecid: 210b3929a73d7c0f:-4b125421:145d440c3de:-8000-0000000000001e3f,0:1:9:5] [tid: 1ce8] [requestid: 26f40010] [sessionid: 26f40000] [username: weblogic] -------------------- Sending query to database named orcl (id: <<32741>>), connection pool named 连接池, logical request hash 4789a0a, physical request hash e0d8142b: [[
select sum(T52.SALES) as c1,
T55.YEAR as c2
from
YTIME T55,
YSALES T52
where ( T52.ID = T55.ID )
group by T55.YEAR
order by c2
如图与SQL
-------------------- SQL Request, logical request hash:
4789a0a
SET VARIABLE QUERY_SRC_CD='Report';SELECT
0 s_0,
"YSALES"."YTIME"."YEAR" s_1,
"YSALES"."YSALES#1"."SALES" s_2,
"YSALES"."YSALES#1"."年度销售同比" s_3
FROM "YSALES"
ORDER BY 1, 2 ASC NULLS LAST
FETCH FIRST 65001 ROWS ONLY
[2014-05-07T10:56:36.000+08:00] [OracleBIServerComponent] [TRACE:2] [USER-18] [] [ecid: 210b3929a73d7c0f:-4b125421:145d440c3de:-8000-0000000000001e3f,0:1:9:5] [tid: 1ce8] [requestid: 26f40010] [sessionid: 26f40000] [username: weblogic] -------------------- Sending query to database named orcl (id: <<32575>>), connection pool named 连接池, logical request hash 4789a0a, physical request hash ed56f113: [[
WITH
OBICOMMON0 AS (select T55.ID as c2,
T55.YEAR as c3,
ROW_NUMBER() OVER (PARTITION BY T55.YEAR ORDER BY T55.YEAR DESC) as c4
from
YTIME T55),
SAWITH0 AS (select Case when case D1.c4 when 1 then D1.c2 else NULL end is not null then Rank() OVER ( ORDER BY case D1.c4 when 1 then D1.c2 else NULL end ASC NULLS LAST ) end as c1,
D1.c2 as c2,
D1.c3 as c3
from
OBICOMMON0 D1),
SAWITH1 AS (select min(D1.c1) over (partition by D1.c3) as c1,
D1.c2 as c2
from
SAWITH0 D1),
SAWITH2 AS (select distinct D1.c1 + 1 as c1,
D1.c2 as c2
from
SAWITH1 D1),
SAWITH3 AS (select Case when case D1.c4 when 1 then D1.c2 else NULL end is not null then Rank() OVER ( ORDER BY case D1.c4 when 1 then D1.c2 else NULL end ASC NULLS LAST ) end as c1,
D1.c3 as c2
from
OBICOMMON0 D1),
SAWITH4 AS (select distinct min(D1.c1) over (partition by D1.c2) as c1,
D1.c2 as c2
from
SAWITH3 D1)
select sum(T52.SALES) as c1,
D3.c2 as c2
from
YSALES T52,
SAWITH2 D5,
SAWITH4 D3
where ( T52.ID = D5.c2 and D3.c1 = D5.c1 )
group by D3.c2
order by c2
]]
[2014-05-07T10:56:36.000+08:00] [OracleBIServerComponent] [TRACE:2] [USER-18] [] [ecid: 210b3929a73d7c0f:-4b125421:145d440c3de:-8000-0000000000001e3f,0:1:9:5] [tid: 1ce8] [requestid: 26f40010] [sessionid: 26f40000] [username: weblogic] -------------------- Sending query to database named orcl (id: <<32741>>), connection pool named 连接池, logical request hash 4789a0a, physical request hash e0d8142b: [[
select sum(T52.SALES) as c1,
T55.YEAR as c2
from
YTIME T55,
YSALES T52
where ( T52.ID = T55.ID )
group by T55.YEAR
order by c2
没有找到相关结果
重要提示:提问者不能发表回复,可以通过评论与回答者沟通,沟通后可以通过编辑功能完善问题描述,以便后续其他人能够更容易理解问题.
2 个回复
指缝阳光2014 - 指尖旋律 2014-05-07 回答
赞同来自: 梁勇
如下所示:
努努 - O(∩_∩)O哈!O(∩_∩)O哈! 2014-05-08 回答
赞同来自: