List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:May 9 2002 10:07pm
Subject:Re: Pretty Simple MAX Value question...
View as plain text  
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

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

Pretty Simple MAX Value question...Andrew Kuebler9 May
  • Re: Pretty Simple MAX Value question...Paul DuBois9 May
    • Re: Pretty Simple MAX Value question...Arjen Lentz10 May
  • RE: Pretty Simple MAX Value question...Gurhan Ozen10 May
RE: Pretty Simple MAX Value question...Max Anderson9 May