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
Hi Andrew,
IT is working as it is supposed to , MAX() only returns one row with the
highest value. IF you wanna get 100 highest values, just order the rows by
id and limit the result set to 100.
SELECT id FROM table WHERE DATE = '20020509' ORDER BY id LIMIT 100
Gurhan
-Original
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'
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 =