Mysql
 sql >> Base de données >  >> RDS >> Mysql

Comment comparer la notation scientifique et les nombres décimaux dans la fonction d'agrégation mysql MIN() ?

Convertir en décimal devrait aider :-

mysql> select cast( "5.89872212195226e-05"  as decimal(65,30));
+--------------------------------------------------+
| cast( "5.89872212195226e-05"  as decimal(65,30)) |
+--------------------------------------------------+
|                 0.000058987221219522600000000000 |
+--------------------------------------------------+

Exemple de comparaison :-

mysql> select least( 4, cast("5.89872212195226e-05" as decimal(65,30)) );
+------------------------------------------------------------+
| least( 4, cast("5.89872212195226e-05" as decimal(65,30)) ) |
+------------------------------------------------------------+
|                           0.000058987221219522600000000000 |
+------------------------------------------------------------+

Exemple d'utilisation :-

MIN(cast( ...  as decimal(65,30)))