Remove duplicates

This commit is contained in:
Andreas Kristiansen
2024-07-17 10:55:04 +02:00
parent 5d63a87dcc
commit c15c58dafd

View File

@@ -536,9 +536,10 @@ class Accumulate_model extends CI_Model
$sql .= " GROUP BY 1) as z
)
SELECT DISTINCT COUNT(grid) OVER (ORDER BY year) as total, year
FROM firstseen
ORDER BY 1
, z as (
SELECT grid, row_number() OVER (partition by grid ORDER BY grid asc, year asc) as rn, year
FROM firstseen
) select DISTINCT COUNT(grid) OVER (ORDER BY year) as total, year from z where rn = 1
";
return $sql;