suttercain Posted February 11, 2010 Share Posted February 11, 2010 Hi everyone, I have a column which stores a total price (i.e. 15.81). Using the following query, what should the column type be? Decimal, Float, Double? Right now I have it set to varchar and the following query won't work with it this way. SELECT * FROM accounts WHERE totalPrice <= '15.81' Thanks. Link to comment https://forums.phpfreaks.com/topic/191786-how-to-store-numeric-values-with-decimals/ Share on other sites More sharing options...
Mchl Posted February 11, 2010 Share Posted February 11, 2010 DECIMAL Link to comment https://forums.phpfreaks.com/topic/191786-how-to-store-numeric-values-with-decimals/#findComment-1010824 Share on other sites More sharing options...
suttercain Posted February 11, 2010 Author Share Posted February 11, 2010 I switched the type to decimal and it converted all the data to whole numbers?!?!? Link to comment https://forums.phpfreaks.com/topic/191786-how-to-store-numeric-values-with-decimals/#findComment-1010826 Share on other sites More sharing options...
Mchl Posted February 11, 2010 Share Posted February 11, 2010 Did you read the manual entry on DECIMAL type first? It is written there, that you have to define number of decimal places you want to store. Link to comment https://forums.phpfreaks.com/topic/191786-how-to-store-numeric-values-with-decimals/#findComment-1010831 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.