Obviously, VARCHAR is not the best datatype for the storage of numerical amounts. If you must use it, you need to CAST the price column to an appropriate numeric type in the SELECT and ORDER BY parts of your statement, or create a view containing the CAST and SELECT from the view.
Obviously, VARCHAR is not the best datatype for the storage of numerical amounts. If you must use it, you need to CAST the price column to an appropriate numeric type in the SELECT and ORDER BY parts of your statement, or create a view containing the CAST and SELECT from the view. The datatype to CAST to, and the syntax for CASTing are product-dependent.
$q1 = "select Price from re2_listings order by CAST(Price AS Float) asc.
First, it helps to know your SQL variant to answer your question. If you still have the ability to control the schema, you are much better off using a numeric data type (e.g. Int or float) for the column and formatting it as a price when it is displayed.
MySQL or SQL Server supports: SELECT t. Price FROM (SELECT r. Price CAST(r.
Price AS DECIMAL(15,2)) 'dprice' FROM RE2_LISTING r) t ORDER BY t. Dprice I casted the varchar column to the appropriate data type, and used the alias dprice so I could reference it for sorting. If you are sorting in ascending fashion, you don't need to specify ASC if you don't want to - it's the default.
One can also use the positional indicator ORDER BY 1 to order by the first column in the result set. – Larry Lustig Oct 30 '09 at 1:04 Ordering by ordinals isn't recommended because if the column order changes - so does the ordering. – OMG Ponies Oct 30 '09 at 1:16.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.