As a couple others have pointed out, your field datatype is character, not
numeric. Now, you have two options here, change the datatype of the column,
or do some "fancy footwork" in the query. Changing the datatype is probably
the best solution, but in case it's not feasible...

Use CONVERT

SELECT yada, yada, yada
FROM mytable
ORDER BY CONVERT(int, nastycharacterfieldname)

Will work in SQL Server or Sybase

Another possibility is CAST:

SELECT yada, yada, yada
FROM mytable
ORDER BY CAST(nastycharacterfieldname AS int)


Michael J. Sheldon
Internet Applications Developer
Phone: 480.699.1084
http://www.desertraven.com/
PGP Key Available on Request

-----Original Message-----
From: Tiffany - Tech Support [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 19, 2000 16:34
To: [EMAIL PROTECTED]
Subject: Silly question from a novice


This is probably the most lame question:

When you do an ORDER BY in a query with a variable that will display
numbers, of course it lists all the numbers like this:

1
12
20
6
70
9

Instead of 1, 6, 9, 12, 20, 70   Why does it do that? And how can I get it
to order them correctly?

Thanks!
_____________________________
Tiffany
Technical Support
the spa! online services
[EMAIL PROTECTED]  (413)539-9818

----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to