Look, you want to store the same level of detail that a decimal(7,4) does?
Easy, you just multiply the conceptual number by 10,000 and it represents hundredths of a cent, the exact same precision you are using in MySQL.
Your examples would then be stored as 20 or 8 respectively. And every other possible value you could store in the MySQL you can now store in SQLite, consistently.
-- Darren Duncan On 2016-12-01 12:08 AM, Werner Kleiner wrote:
As I can see storing prices is a topic with different ways and different solutions. The advice to store prices in Cent or Integer: Yes you can do: but how will you sore hundredth cents amounts or tenth cent prices? I have prices like 0,0020 or 0,0008 Euro I think I have to manipulate the prices for viewing in the app with PHP. Fact is: we can have to DBs MySQL and SQlite. MySQL with decimal(7,4) stores a price 1.500 from a textfield exact so. If you want to show the price again in the app, there is nothing to do. But switching to SQLite the price is viewed as 1.5 (and stored) I know this is no error of SQLite. But I have now to differ between Sqlite and MySQL and have to optimize the SELECT and adding 00 programmatically to view correct if using Sqlite. My original post was if there is a way for both DBs with same behavior, but it seems not. Thanks to all for help.
_______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users