I could be totaly wrong, but would make me happy if it helped<BR><BR>sqlF="select max(recID) as NewMaxID from MyTable where MyField = '" & request.form("txtMyField")& "';"<BR><BR>Or any other criteria<BR><BR>
Actually, this works for me:<BR><BR>select * from [tablename] <BR>where [datecolumn]=(select max(datecolumn) from [tablename])<BR><BR>But I wondered if there's some ASP logic I could use for future reference.
To make it slightly more efficient, you can just bring back the top row.<BR><BR>I can never remember how to do it in Oracle (been ages since I used it). In Access/SQL Server you can do:<BR><BR>SELECT TOP 1 MyField FORM MyTable ORDER BY dateColumn DESC<BR><BR>I think there's a LIMIT keyword for MySQL...<BR><BR>Dunno. That's definately more efficient than your current subquery though. Just my 2p.<BR><BR>Craig.