MAX | Maximum |
---|---|
Sybase |
Syntaxe
Max(argument) |
Paramètres
Nom | Description |
---|---|
argument | Ce paramètre permet d'indiquer que le champ devant être comparer. |
Description
Cette fonction retourne la plus haute valeur d'une liste d'argument.
Exemple
Voici un exemple permettant d'afficher les plus grandes valeurs en contournant le problème qu'il n'accepte pas une liste de valeurs directement comme paramètre dans la fonction :
- SELECT 'MAX(5,-18)=' AS Text,max(X) AS Result FROM (SELECT 5 AS X UNION SELECT -18 AS X) AS TableData UNION
- SELECT 'MAX(0.25,0.115)=' AS Text, max(X) AS Result FROM (SELECT 0.25 AS X UNION SELECT 0.115 AS X) AS TableData UNION
- SELECT 'MAX(1,2,3,4,5)=' AS Text,max(X) AS Result FROM (SELECT 1 AS X UNION SELECT 2 AS X UNION SELECT 3 AS X UNION SELECT 4 AS X UNION SELECT 5 AS X) AS TableData UNION
- SELECT 'MAX(5,4,3,2,1)=' AS Text, max(X) AS Result FROM (SELECT 5 AS X UNION SELECT 4 AS X UNION SELECT 3 AS X UNION SELECT 2 AS X UNION SELECT 1 AS X) AS TableData UNION
- SELECT 'MAX(24,34,13,72,100,1,34)=' AS Text, max(X) AS Result FROM (SELECT 24 AS X UNION SELECT 34 AS X UNION SELECT 13 AS X UNION SELECT 72 AS X UNION SELECT 100 AS X UNION SELECT 1 AS X UNION SELECT 34 AS X) AS TableData
on obtiendra le résultat suivant :
Text | Result |
MAX(5,-18)= | 5.000 |
MAX(0.25,0.115)= | 0.250 |
MAX(1,2,3,4,5)= | 5.000 |
MAX(5,4,3,2,1)= | 5.000 |
MAX(24,34,13,72,100,1,34)= | 100.000 |
Voir également
Langage de programmation - Sybase - Référence de fonctions - AVG
Langage de programmation - Sybase - Référence de fonctions - MIN
Dernière mise à jour : Dimanche, le 31 mai 2015