Maximum Value Retrieval

Maximum Value Retrieval

Post by WEB111 » Wed, 06 Nov 2002 05:34:02



Hi,

I have a table in which each record has a variable valued integer field.  I
don't know what record has the largest value.  Can one of you provide me
with a simple SQL query to find and return the maximum value in this field.

I just had a thought.  If I specify this integer field as an ascending
index, is there a simple SQL query that would return the last record in the
index, thus providing me with the largest value.

Thanx,
Bill

 
 
 

Maximum Value Retrieval

Post by Anith Se » Wed, 06 Nov 2002 05:35:57


Try:

SELECT *
  FROM yourTable
 WHERE yourintCol = (SELECT MAX(yourintCol)
                       FROM yourTable)

--
- Anith