MySql float where 出錯問題

  • 334
  • 0

摘要:MySql float where 出錯問題

因為float會出錯,

所有有兩篇文章說明解決這個問題

一個是,將float改為

Use decimal instead of float.

http://stackoverflow.com/questions/6135395/mysql-float-data-not-selecting-in-where-clause

或則

使用cast轉換成decimal處理

SELECT * FROM table WHERE CAST(price AS DECIMAL) = CAST(101.31 AS DECIMAL);

http://stackoverflow.com/questions/1302243/selecting-a-float-in-mysql