KNN combined with other clauses

المشرف العام

Administrator
طاقم الإدارة
I have a table with columns:-

wkb_geometry (geometry), road_id character varying, year INTEGER The data set has multiples of road_id across many years. I want to get the nearest 10 values to a point with the most recent year and only one distinct value for road_id. So this would give me most up to date values for the ten nearest roads to my point.

I know that the KNN WHERE clause is:-

ORDER by cp,wkb_geometry ST_Transform($1,27700) LIMIT 10 But how do I combine this with the other requirements to get an efficient query?



أكثر...
 
أعلى