At 16:30 -0400 5/9/02, Andrew Kuebler wrote:
>I want to select say 100 of 1,000 records and get the highest value for
>"id" in that query, however the MAX command always gives me the MAX for
>the whole table, not just my query.
>
>Here's my expression:
>
>SELECT MAX(id) FROM table WHERE DATE = '20020509' LIMIT 100
>
>No matter what, I will always get the max for the column for the whole
>table....adding and removing the "LIMIT" command changes absolutely
>nothing...

That's how LIMIT works.  It's applied after the rest of your statement.

That said, it's not clear to me why you need LIMIT at all.  The
statement as written should return a single row consisting of a single
column (the maximum id value of the rows with the given date).

>Thanks to anyone that might be able to help me...
>
>Frustrated,
>Andrew


---------------------------------------------------------------------
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