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、Y
是同一个表中的所有列,我需要将每行前三列的值相加,并将它们作为 TOTAL 附加到查询结果中。任何帮助表示赞赏,使用 SQL Plus,11g 机架