Difference between revisions of "SQL MAX()"
From Lianjapedia
Yvonne.milne (Talk | contribs) |
|||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
Returns a maximum value in a SELECT statement | Returns a maximum value in a SELECT statement | ||
− | |||
==Syntax== | ==Syntax== | ||
− | MAX(< | + | MAX(<expr1> [, <expr2> [, ...]]) |
− | + | ||
==See Also== | ==See Also== | ||
[[SQL Aggregate Functions|AGGREGATES]], [[AVG()]], [[COUNT()]], [[SQL MIN()|MIN()]], [[SQL SELECT|SELECT]], [[SUM()]] | [[SQL Aggregate Functions|AGGREGATES]], [[AVG()]], [[COUNT()]], [[SQL MIN()|MIN()]], [[SQL SELECT|SELECT]], [[SUM()]] | ||
+ | ==Description== | ||
+ | Returns the maximum value of <expr1> or the list of expressions (list supported from v6.0). | ||
− | + | The expressions can be of the following data types: | |
− | + | * Numeric | |
− | + | * Date | |
+ | * Character (from v6.0) | ||
+ | * Currency (from v6.0) | ||
+ | * Datetime (from v6.0) | ||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | + | open database southwind | |
+ | select max(orderdate,requireddate,shippeddate) from orders | ||
+ | select max(companyname) from customers | ||
</code> | </code> | ||
− | |||
− | |||
− | |||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:SQL|MAX()]] | [[Category:SQL|MAX()]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
+ | [[Category:SQL Functions]] | ||
+ | [[Category:Lianja v6.0]] |
Latest revision as of 06:37, 23 February 2021
Contents
Purpose
Returns a maximum value in a SELECT statement
Syntax
MAX(<expr1> [, <expr2> [, ...]])
See Also
AGGREGATES, AVG(), COUNT(), MIN(), SELECT, SUM()
Description
Returns the maximum value of <expr1> or the list of expressions (list supported from v6.0).
The expressions can be of the following data types:
- Numeric
- Date
- Character (from v6.0)
- Currency (from v6.0)
- Datetime (from v6.0)
Example
open database southwind select max(orderdate,requireddate,shippeddate) from orders select max(companyname) from customers