Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

quantity count and group by some article

SUM(quantity) OVER (PARTITION BY article) AS total_units_sold

and 

SUM(quantity) OVER (PARTITION BY article, sale_month) AS units_sold_month,
  
  and 

( ( SUM(quantity) OVER (PARTITION BY article, sale_month)::decimal /
           SUM(quantity) OVER (PARTITION BY article)::decimal ) * 100
       ) AS month_percentage
 
PREVIOUS NEXT
Tagged: #quantity #count #group #article
ADD COMMENT
Topic
Name
1+1 =