Create Table NEW AS (
SELECT
"60+ DAYS",
"30-60 DAYS",
"7-30 DAYS",
( select ("60+ DAYS"+"30-60 DAYS"+"7-30 DAYS")
from Schema.Table
Where Schema.Table.Column1 like '%X%'
and (Schema.Table.Column2 like '%Y%' or Schema.Table.Column2 like '%Y%')
) as "TOTAL",
"ROLE OWNERS NAME",
"ROLE OWNERS EMAIL",
FROM Schema.Table
Where Schema.Table.Column1 like '%X%'
and (Schema.Table.Column2 like '%Y%' or Schema.Table.Column2 like '%Y%' )
ORDER BY "60+ DAYS",
"30-60 DAYS",
"7-30 DAYS" desc;
有人可以告诉我如何关联我的子查询,
“60多天”, “30-60天”, “7-30天”, “角色所有者名称”, “角色所有者电子邮件”, X, ÿ
是同一个表中的所有列,我需要对每行的前三列行的值求和,并将它们作为TOTAL附加到查询结果中。感谢任何帮助,使用SQL Plus,11g机架
答案 0 :(得分:0)
不确定我是否理解你要做的事情,但是删除子查询呢?
SELECT
"60+ DAYS",
"30-60 DAYS",
"7-30 DAYS",
("60+ DAYS" + "30-60 DAYS" + "7-30 DAYS") as "TOTAL",
...