Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

order by numerically?

Status
Not open for further replies.

davebiscuits

IS-IT--Management
Jan 19, 2004
4
AU
SELECT house_number from house order by house_number asc;" gives me:

(house_number is of character varying type)

1
11
1A
2
222
2A
3
33

How can I get this to order my results numerically?

I tried "SELECT house_number from house order by house_number::text::integer asc;" but it doesnt like my "1A" or "2A" entries.

Any thoughts?

Thanks in advance,
Dave.

 
Try this:

"SELECT house_number from house order by value(house_number) asc;"

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top