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. Quote 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 Quote 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?!?!? Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.