Tuesday, December 19, 2006

Sort powers in MySQL

We are using the ORDER BY CAST (field AS SIGNED) clause to sort the results by ‘power’ field. But it’s wrong!!

The way for sort ‘power’ it’s: ORDER BY `Power`+0

Strange… but works fine!!!

1 comment:

Anonymous said...

Yes, it's strange. But MySQL has these "peculiarities".