Subject | RE: [firebird-support] Find record with max value |
---|---|
Author | Johan van Zyl |
Post date | 2004-08-30T07:38:57Z |
From http://www.w3schools.com/sql/func_max.asp
Function MAX
----------------------------------------------------------------------------
----
The MAX function returns the highest value in a column. NULL values are not
included in the calculation.
Syntax
SELECT MAX(column) FROM table
Example
SELECT MAX(Age) FROM Persons
Result:
45
Note: The MIN and MAX functions can also be used on text columns, to find
the highest or lowest value in alphabetical order.
-----Original Message-----
From: Planles [mailto:planles@...]
Sent: 30 August 2004 09:07
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Find record with max value
Hi!
I have a table with a few fields, one of them is integer type.
I want to get a record which value of this integer field is maximal.
What sql sentence should I use ?
How can I be sure, that there is only one record with this max value ?
Let say, that my values are 1,2,3,4,5,5.
Would there be then both records with value 5 returned ?
Regards,
Primoz
Yahoo! Groups Sponsor
ADVERTISEMENT
----------------------------------------------------------------------------
--
Yahoo! Groups Links
a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/
b.. To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.745 / Virus Database: 497 - Release Date: 2004/08/27
[Non-text portions of this message have been removed]
Function MAX
----------------------------------------------------------------------------
----
The MAX function returns the highest value in a column. NULL values are not
included in the calculation.
Syntax
SELECT MAX(column) FROM table
Example
SELECT MAX(Age) FROM Persons
Result:
45
Note: The MIN and MAX functions can also be used on text columns, to find
the highest or lowest value in alphabetical order.
-----Original Message-----
From: Planles [mailto:planles@...]
Sent: 30 August 2004 09:07
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Find record with max value
Hi!
I have a table with a few fields, one of them is integer type.
I want to get a record which value of this integer field is maximal.
What sql sentence should I use ?
How can I be sure, that there is only one record with this max value ?
Let say, that my values are 1,2,3,4,5,5.
Would there be then both records with value 5 returned ?
Regards,
Primoz
Yahoo! Groups Sponsor
ADVERTISEMENT
----------------------------------------------------------------------------
--
Yahoo! Groups Links
a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/
b.. To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.745 / Virus Database: 497 - Release Date: 2004/08/27
[Non-text portions of this message have been removed]