scrubbicus Posted May 22, 2009 Share Posted May 22, 2009 So I'm trying to create an ORDER BY for all four columns in my table (name, price, date, and category) three out of four are ordering the way I want them to but price is ordering by the first highest numerical digit rather by then how many total digits there are. So $6 is higher then $2000 in this case and $10000 is lower then both of them. How would I go about ordering the price column by highest and lowest? Quote Link to comment https://forums.phpfreaks.com/topic/159312-solved-using-order-by-value-descasc-for-a-price-table/ Share on other sites More sharing options...
Ken2k7 Posted May 22, 2009 Share Posted May 22, 2009 By not storing price as a string, but a number and format it in the output. Quote Link to comment https://forums.phpfreaks.com/topic/159312-solved-using-order-by-value-descasc-for-a-price-table/#findComment-840223 Share on other sites More sharing options...
scrubbicus Posted May 22, 2009 Author Share Posted May 22, 2009 Damn totally knew that haha thanks. Quote Link to comment https://forums.phpfreaks.com/topic/159312-solved-using-order-by-value-descasc-for-a-price-table/#findComment-840275 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.