SELECT MAX(id)
FROM  (SELECT MAX(id)
       FROM   table
       WHERE  DATE = '20020509'
       LIMIT 100)

Dunno if this works in MySQL, I can't access a MySQL database from here to
test it out.

This should return the value that you want but I would be interested to
learn the usefulness of running such a query without restricting it further
than simply using LIMIT 100.  Do you not need to ORDER BY your data either?
What if all your high IDs are after record 100?

Of course, I don't know you application, just bein' nosey.

- Max

Martin Anderson
QA Engineer
ProfitLogic
Eleven Cambridge Center
Cambridge, MA 02142
t: 617.218.1946

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to