Facendo Order by cast(campo as signed) desc mi ordina bene gli interi, ma se ho 1,5 e 1,6 non li metti dal più grande a scendere. Come li ordino? Thanks![]()
Facendo Order by cast(campo as signed) desc mi ordina bene gli interi, ma se ho 1,5 e 1,6 non li metti dal più grande a scendere. Come li ordino? Thanks![]()
hai provato con
Order by cast(campo as decimal) desc
???
Da' errore.
i valori decimali li scrivi col punto ? tipo 1.5, 1.6 e non con la virgola...
Ho provato nei 2 modi, non cambia.
Strano, facendo il replace della virgola col punto deve funzionareOriginariamente inviato da poeta1978
Ho provato nei 2 modi, non cambia.
codice:select * from tabella order by cast(replace(campo_valori,',','.') as decimal) desc
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'decimal) DESC' at line 1
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home1/site/public_html/site/classifiche.php on line 120
manuale
The CAST() and CONVERT() functions may be used to take a value of one type and produce
a value of another type. Their syntax is:
CAST(expression AS type)
CONVERT(expression,type)
CONVERT(expr USING transcoding_name)
The type value can be one of the following:
² BINARY
² CHAR
² DATE
² DATETIME
² SIGNED {INTEGER}
² TIME
² UNSIGNED {INTEGER}