I am using an OGR connection to a shapefile in a MapServer map file in order to use SQL to get the last record in the shape.&nbsp; <br><br>I have tried to order it by an ID column descending and then use limit 1 or rownum = 1, these didn&#39;t work.&nbsp; 
<br><br>I have also tried WHERE ID = MAX(ID), but I get an error message that indicates that MAX is being interpreted as a string and that the comparison is illegal.<br><br>
msOGRFileOpen(): OGR error. ExecuteSQL(SELECT FID, * FROM bryantrip WHERE FID = MAX(FID) ORDER BY timeLoc desc) failed.
SQL: Attempt to compare numeric field `FID&#39; to non-numeric value `MAX&#39; is illegal. <br><br>Can anyone suggest OGR SQL to get the last row of the shape?&nbsp; <br><br>Thanks, <br><br>David.<br>