Using 'Select By Attributes' how can I select records from a shapefile database table where a numeric field contains the largest value. Need to use MAX function or something like that but can't get the syntax right.
|
|
Try:
|
|||||||
|
|
if using ArcMap,Pablo has suggested a rigth query syntax,pay attention only where clause must be entered in "select by attribute" dialog,mean this phrase: "numfield=(SELECT MAX(numfield) FROM tablename)" |
|||||
|
|
If you are using Esri ArcGIS, then you can use Summary Statistics to calculate the maximum value (as well as min, mean, etc). Then you can use Select By Attributes to select the records that match the max value output by the Summary Statistics tool. Since you are selecting from a Shapefile, there is no way through a SQL-like syntax to retrieve the max value. I imagine you are trying something like |
|||||
|
|
You haven't specified what software you're using, but based on the use of the term 'select by attributes' we can guess ArcGIS. If you're using 9.x, you can use this code to calculate the maximum in VBA, or if you're on 10, you could write a simple python analog. |
|||||
|

