Oracle
 sql >> Base de données >  >> RDS >> Oracle

Colonne de retour Oracle SQL calculée à partir de colonnes existantes

  • Utiliser CTE
with data as (

select 
t1.name, 
(select count(*) from t2 where t2.name = t1.name) X, 
(select count(*) from t3 where t3.name = t1.name) Y
from t1
)

select 
data.*,
data.x/data.y as new_calculation
from data