Windowing Functions: Partition By

February 15, 2016
By Bounteous
SELECT
  num,
  COUNT(num) OVER (PARTITION BY num) AS partion_count,
  COUNT(num) OVER () AS plain_count
FROM 
  ( SELECT 2 AS num),
  ( SELECT 4 AS num),
  ( SELECT 3 AS num),
  ( SELECT 1 AS num),
  ( SELECT 1 AS num),