SQL ORDER BY clause - TechRepublic
General discussion
December 18, 2002 at 12:23 AM
madestroitsolutions

SQL ORDER BY clause

by madestroitsolutions . Updated 23 years, 6 months ago

When I run a query against an SQL server database with an ORDER BY clause, the result set is ordered “alphabetically”:

Query:
SELECT Product_VAMID FROM Product ORDER BY Product_VAMID

1060-a
1060-s
11-a
11-s
1645-a
1645-s

I need to order it “numerically”:

11-a
11-s
1060-a
1060-s
1645-a
1645-s

How can I achieve this? I have tried several different ways, and searched everywhere, but I cant seem to find a way. All help appreciated.
thanks in advance.

This discussion is locked

All Comments