Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-01-03 : 10:00:52
|
| Grant writes "I have a field in a database called pageHits and it logs the ammount of hits each page gets, when i try to do an order by to get all the pages with the most hits displaying at the top it displays in an order of 9,8,7,6,5,4,3,2,1,10,11 like that instead of 11,10,9,8,7,6,etcIs there anyway of gettting it to order correctly??HERE IS THE SQL:SELECT * FROM Pages ORDER BY PageHits DESC" |
|
|
PiecesOfEight
Posting Yak Master
200 Posts |
Posted - 2002-01-03 : 10:11:17
|
| It is sorting in ASCII order b/c the column is defined as char or varchar. If you use int (or smallint or tinyint) for the datatype, it will sort in the order you want. |
 |
|
|
|
|
|
|
|