在 select 上进行内部连接而不从中创建视图
inner join on select without creating a view from it
你好,我想在 select 上编写内部连接而不用它创建视图
喜欢:
select date_,sum(t.weight)-sum(t2.miscalc) as weight from (
select decode(rownum, 1, '20201001',2, '20201005',3, '20201003',4, '20201004', 5,'20201002') as date_,
decode(rownum, 1, 9999,2, 8,3, 9998, 4,9999,5, 9997) as weight,
decode(rownum, 1, 1299,2, 8,3, 1298, 4,1299,5, 1297) as miscalc
from dual
connect by level <= 5) t inner join t t2 on t.date_>t2.date_
group by t.date_
我的内部 select 是这样的
我应该从重量中减去所有旧错误的总和
我可以用
与...作为子句
with select * from (
select decode(rownum, 1, '20201001',2, '20201005',3, '20201003',4, '20201004', 5,'20201002') as date_,
decode(rownum, 1, 9999,2, 8,3, 9998, 4,9999,5, 9997) as weight,
decode(rownum, 1, 1299,2, 8,3, 1298, 4,1299,5, 1297) as miscalc
from dual
connect by level <= 5) as t
select date_,sum(t.weight)-sum(t2.miscalc) as weight from t inner join t t2 on t.date = t2.date
你好,我想在 select 上编写内部连接而不用它创建视图 喜欢:
select date_,sum(t.weight)-sum(t2.miscalc) as weight from (
select decode(rownum, 1, '20201001',2, '20201005',3, '20201003',4, '20201004', 5,'20201002') as date_,
decode(rownum, 1, 9999,2, 8,3, 9998, 4,9999,5, 9997) as weight,
decode(rownum, 1, 1299,2, 8,3, 1298, 4,1299,5, 1297) as miscalc
from dual
connect by level <= 5) t inner join t t2 on t.date_>t2.date_
group by t.date_
我的内部 select 是这样的
我应该从重量中减去所有旧错误的总和
我可以用 与...作为子句
with select * from (
select decode(rownum, 1, '20201001',2, '20201005',3, '20201003',4, '20201004', 5,'20201002') as date_,
decode(rownum, 1, 9999,2, 8,3, 9998, 4,9999,5, 9997) as weight,
decode(rownum, 1, 1299,2, 8,3, 1298, 4,1299,5, 1297) as miscalc
from dual
connect by level <= 5) as t
select date_,sum(t.weight)-sum(t2.miscalc) as weight from t inner join t t2 on t.date = t2.date