User Tools

Site Tools


ml:codesamples

This section is dedicated to useful code snippets to help with analyzing data

SQL Commands

Select for generating a run total and calculating the median value Oracle:

SELECT PO_DT FROM (
  SELECT 
    PO_DT, 
    COUNT(PO_ID) OVER (ORDER BY PO_DT) AS RUNSUM,
    COUNT(PO_ID) OVER () AS TOTAL
  FROM PS_PO_HDR_SUM_VW
 ) 
WHERE RUNSUM >= (TOTAL / 2)
AND ROWNUM=1 ;
ORDER BY PO_DT;
/opt/bitnami/dokuwiki/data/pages/ml/codesamples.txt · Last modified: 2019/08/12 13:56 by david.brunet