Ordering a varchar field in mysql
| From: | Vaibhav Informatics | Date: | Tue, 04 Dec 2007 05:42:40 +0000 |
| Subject: | Ordering a varchar field in mysql | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-44385@lists.php.net to get a copy of this message | ||
*Questions on PHP*
In one of our tables, one of the field is acc_no, we had given the data type
as varchar, since it could take any alpha-numeric values. In viewing this,
we used 'order by acc_no.' The sequence of records shown was
1,10,100,1000,A1, A10, A100, etc. whereas we want the sequence to be
1,2,3,4,etc. for all the numeric values followed by alpha-numeric values A1,
A2, A3, etc.
Can someone please give us the code for this type of ordering?
--
Vaibhav Informatics, 109 Vasant Plaza, Munirka, Near Subway, New Delhi-110
067 Ph: 011-26194466 Email :vaibhavinformatics@gmail.com