How do I sort a varchar column using numeric ordering

Posted by karthikeyan1211 on Stack Overflow See other posts from Stack Overflow or by karthikeyan1211
Published on 2010-04-15T11:30:52Z Indexed on 2010/04/15 11:53 UTC
Read the original article Hit count: 255

Filed under:
|

I have the field receiptno, which is a varchar holding a numeric value, and want to sort this. Sorting as a string gives me the wrong ordering. I'd like to try sorting it as an integer. Is there anyway to converting to integer in the order by clause so I can sort by integer in the query itself.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about order