Forum Moderators: coopster
Probably the easiest is to declare an INTEGER field that stores the number of cents, not dollars. When you need to present the data as dollars, of course you just divide by 100. (You may need to use MEDIUMINT or BIGINT if you are working with very large numbers.)
Or, you can just declare the field to be a FLOAT, which can handle decimals. Theoretically, FLOAT fields aren't exact values. So if a very large number is added (>1,000,000,000,000,000,000,000) you may not get an exact dollar and cent value.
You'll want to check out the field definitions for your particular flavor of SQL. If you are using MySQL, this information can be found here:
[mysql.com...]
add it before limit if you have that in you query and after group if you have that in your query else put in in the end.
don't know if that was what you meant;
an difficult way to do the same thing:
order by price=1 desc, price=2 desc, price=12 desc
learned it on webmasterworld.
However, as mentioned here, there are a number of ways for Storing monetary values in MySQL [webmasterworld.com]. MySQL recommends [mysql.com] using the
DECIMAL Numeric Type [mysql.com].