Oracle
 sql >> Database >  >> RDS >> Oracle

Posso utilizzare la funzione analitica Oracle qui?

Certo, puoi usare analisi, qualcosa del genere:

SELECT DISTINCT YEAR, MONTH, WEEK, CPG, DEPT, CUST_ID, R_ID,
       SUM(P1) OVER (PARTITION BY YEAR,MONTH,WEEK, CPG, DEPT, CUST_ID, R_ID) P1,
       SUM(IC) OVER (PARTITION BY YEAR,MONTH,WEEK, CPG, DEPT, CUST_ID, R_ID) IC,
       SUM(B1) OVER (PARTITION BY YEAR,MONTH,WEEK, CPG, DEPT, CUST_ID, R_ID) B1, 
       P2, B2, TOT, TOTAL_TXN, TOTAL_AMT 
  FROM (your_query)