Skip to content

Commit

Permalink
Merge pull request #713 from MTES-MCT/fix-natural-keys
Browse files Browse the repository at this point in the history
Suppression des duplicates de la table occupation_du_sol_zonage_urbanisme
  • Loading branch information
alexisig authored Nov 6, 2024
2 parents b6bbf56 + 266d398 commit da8761e
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,18 @@ with max_ocsge_loaded_date as (
where ocsge.loaded_date > (select ocsge_loaded_date from max_ocsge_loaded_date)
or zonage.gpu_timestamp > (select zonage_gpu_timestamp from max_zonage_gpu_timestamp)
{% endif %}
), occupation_du_sol_zonage_urbanisme_without_surface_with_duplicates_marked as (
SELECT
*,
row_number() over (partition by geom, year, departement) as rn
FROM
occupation_du_sol_zonage_urbanisme_without_surface
)

SELECT
*,
ST_Area(geom) as surface
FROM
occupation_du_sol_zonage_urbanisme_without_surface
occupation_du_sol_zonage_urbanisme_without_surface_with_duplicates_marked
WHERE
rn = 1

0 comments on commit da8761e

Please sign in to comment.