Created
October 24, 2013 09:08
-
-
Save kidpixo/7133792 to your computer and use it in GitHub Desktop.
amazza che mazzasql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH p AS ( | |
SELECT * | |
FROM (SELECT array_agg(id_meas) AS arr_id_meas,id_poly FROM user_polygons_vertex_intersection GROUP BY id_poly ORDER BY COUNT(id_meas) ASC LIMIT 2 OFFSET 500) up_in | |
INNER JOIN user_polygons up ON up_in.id_poly=up.polygon_id | |
WHERE view_short_name='global_grid_1dpp' | |
) | |
SELECT COUNT(m.id_meas),p.id_poly,trim(first(p.polygon_name)) AS polygon_name,ST_AsText(first(p.polygon)) | |
FROM vir_point_data m,p | |
WHERE m.id_meas = ANY (p.arr_id_meas) | |
GROUP BY p.id_poly; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment