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;
Can someone advise me on how I might correlate my subquery,
"60+ DAYS", "30-60 DAYS", "7-30 DAYS", "ROLE OWNERS NAME", "ROLE OWNERS EMAIL", X, Y
are all columns in the same table, and I need to sum the values of the first three columns row per row and append them as TOTAL to the query result. Any help is appreciated, using SQL Plus, 11g rack
Not sure if I understand what you are trying to do, but what about removing the subquery?
SELECT
"60+ DAYS",
"30-60 DAYS",
"7-30 DAYS",
("60+ DAYS" + "30-60 DAYS" + "7-30 DAYS") as "TOTAL",
...