Is there a way to do an SQL query for the lowest value?

485
3
01-09-2012 10:23 AM
RebeccaNoll
New Contributor
I am trying to build a model that will first select a group of points based on an ID field and then select the lowest value in a distance field so I will get the shortest distance for each group.  Is there a way to build a query for that?
Thanks!
Rebecca
0 Kudos
3 Replies
RichardFairhurst
MVP Honored Contributor
I am trying to build a model that will first select a group of points based on an ID field and then select the lowest value in a distance field so I will get the shortest distance for each group.  Is there a way to build a query for that?
Thanks!
Rebecca


No, not within a single table/feature class.  There is a way to do it if there are two tables/feature classes.  See the discussion on Subqueries here.  I normally use the SummaryStatistics tool in the Analysis group to get a Min value and join it to the ID to select the lowest record or make other adjustments relative to the minimum value.
0 Kudos
RebeccaNoll
New Contributor
Thanks - that worked great!
0 Kudos
RichardFairhurst
MVP Honored Contributor
Thanks - that worked great!


Please mark the thread answered for the benefit of others looking for solutions to similar problems.  I assume you used the SummaryStatistics approach given the speed of your respoinse.  Thanks.
0 Kudos