Oracle
 sql >> Datenbank >  >> RDS >> Oracle

Kann ich hier die Analysefunktion von Oracle verwenden?

Sicher, Sie können Analysen verwenden, etwa so:

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)