Skip to content

Commit 58c0d33

Browse files
simonsabinrwestMSFT
authored andcommitted
Update MAX function to point at GREATEST
Point people at GREATEST if looking for max of a set of values inline Fix formatting and add reference to GREATEST function Fix link formatting for OVER clause in MAX function Fix grammar in MAX function documentation Corrected grammatical errors for clarity. Clarify MIN function description and add LEAST reference Updated the description of the MIN function to clarify its behavior and added a reference to the LEAST function for inline minimum values. Update min-transact-sql.md Fix link to OVER clause in MAX function documentation
1 parent 58e28b0 commit 58c0d33

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

docs/t-sql/functions/max-transact-sql.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ monikerRange: ">= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest |
2121
# MAX (Transact-SQL)
2222
[!INCLUDE [sql-asdb-asdbmi-asa-pdw-fabricse-fabricdw](../../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw-fabricse-fabricdw.md)]
2323

24-
Returns the maximum value in the expression.
24+
Returns the maximum of all values of the specified expression in a group. May be followed by the [OVER clause](../../t-sql/queries/select-over-clause-transact-sql.md)
25+
If you want the maximum of all values of multiple expressions inline then look at [GREATEST](logical-functions-greatest-transact-sql.md)
2526

2627
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: [Transact-SQL syntax conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
2728

@@ -49,7 +50,7 @@ MAX ([ ALL ] expression) OVER ( <partition_by_clause> [ <order_by_clause> ] )
4950

5051
OVER **(** _partition\_by\_clause_ [ _order\_by\_clause_ ] **)**
5152
*partition_by_clause* divides the result set produced by the FROM clause into partitions to which the function is applied. If not specified, the function treats all rows of the query result set as a single group. *order_by_clause* determines the logical order in which the operation is performed. *_partition\_by\_clause_* is required. For more information, see [OVER Clause &#40;Transact-SQL&#41;](../../t-sql/queries/select-over-clause-transact-sql.md).
52-
53+
5354
## Return Types
5455
Returns a value same as *expression*.
5556

@@ -61,6 +62,8 @@ MAX ([ ALL ] expression) OVER ( <partition_by_clause> [ <order_by_clause> ] )
6162
For character columns, MAX finds the highest value in the collating sequence.
6263

6364
MAX is a deterministic function when used without the OVER and ORDER BY clauses. It is nondeterministic when specified with the OVER and ORDER BY clauses. For more information, see [Deterministic and Nondeterministic Functions](../../relational-databases/user-defined-functions/deterministic-and-nondeterministic-functions.md).
65+
66+
Operates on a set of rows. To obtain the MAX value for a set of values inline, then look at [GREATEST](logical-functions-greatest-transact-sql.md)
6467

6568
## Examples
6669

@@ -135,6 +138,7 @@ The last system database is `tempdb`.
135138

136139
## See Also
137140
[Aggregate Functions &#40;Transact-SQL&#41;](../../t-sql/functions/aggregate-functions-transact-sql.md)
141+
[GREATEST](logical-functions-greatest-transact-sql.md)
138142
[OVER Clause &#40;Transact-SQL&#41;](../../t-sql/queries/select-over-clause-transact-sql.md)
139143

140144

docs/t-sql/functions/min-transact-sql.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ monikerRange: ">= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest |
2121
# MIN (Transact-SQL)
2222
[!INCLUDE [sql-asdb-asdbmi-asa-pdw-fabricse-fabricdw](../../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw-fabricse-fabricdw.md)]
2323

24-
Returns the minimum value in the expression. May be followed by the [OVER clause](../../t-sql/queries/select-over-clause-transact-sql.md).
24+
Returns the minimum of all values of the specified expression in a group. May be followed by the [OVER clause](../../t-sql/queries/select-over-clause-transact-sql.md)
25+
If you want the minimum of all values of multiple expressions inline then look at [LEAST](logical-functions-least-transact-sql.md)
2526

2627
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: [Transact-SQL syntax conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
2728

@@ -59,6 +60,8 @@ MIN ( [ ALL ] expression ) OVER ( [ <partition_by_clause> ] [ <order_by_clause>
5960
With character data columns, MIN finds the value that is lowest in the sort sequence.
6061

6162
MIN is a deterministic function when used without the OVER and ORDER BY clauses. It is nondeterministic when specified with the OVER and ORDER BY clauses. For more information, see [Deterministic and Nondeterministic Functions](../../relational-databases/user-defined-functions/deterministic-and-nondeterministic-functions.md).
63+
64+
Operates on a set of rows. To obtain the MIN value for a set of values inline, then look at [LEAST](logical-functions-least-transact-sql.md)
6265

6366
## Examples
6467

@@ -170,6 +173,7 @@ LeastExpensiveProduct SalesOrderID
170173
## See Also
171174
[Aggregate Functions &#40;Transact-SQL&#41;](../../t-sql/functions/aggregate-functions-transact-sql.md)
172175
[MAX &#40;Transact-SQL&#41;](../../t-sql/functions/max-transact-sql.md)
176+
[LEAST](logical-functions-least-transact-sql.md)
173177
[OVER Clause &#40;Transact-SQL&#41;](../../t-sql/queries/select-over-clause-transact-sql.md)
174178

175179

0 commit comments

Comments
 (0)