Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Alright. My question is: why do computers order single-digit numbers before double digits.
I run a website that uses databases and ASP interacts with the Access databases. Since today is the tenth, I made a post on the website, and all posts were ordered by dates. Well, the post was placed AFTER all May 1-9 posts. So I switched to the primary key field, which is a totally unique number. Well, it worked nicely, except I had ONE post that was a single-digit key. And I figured if I just delete it, it'd be a temporary problem, and once I hit the triple-digits the problem would resurface, possibly creating more problems.
So say I have variables called intX and intY. If they're two unique keys in a database, in a field called "ID", and I tell ASP to print all results, sorted by ID in descending order... If intX = 5 and intY = 15, intX will be printed first. The same goes for dates. If intX was a date, and it was made on 5/5/04, and intY was 5/15/04, and we sorted the results by that field, the row with intX as its date would be printed FIRST, even though it was older.
Can anyone help me on this one? My website is http://mor4wd.com/lb , check the dates on my posts and see what I mean (look at all posts made in May)... Thanks all.

"why do computers order single-digit numbers before double digits?"
Conventional alphabetical ordering is the same (A would go before AA). There's also a much more complicated technical reason having to do with symbol vs. value and number systems.
You're asking SQL to sort by decimal, which I don't think it can do. Normally in a database, to order your entries you simply adds a new row for each entry and pull the rows in order of their ID (the newest ID is also the most recent). No date sorting required, because the newest row always has the highest ID. You just autoincrement the primary key and sort by key sorts which automatically sorts by date. So I'm not entirely sure how you got into this, unless your primary key was a date... maybe I misunderstood your post.
If that is the case, you case you need another step (Personally, I would redo the table, because this is backwards). Let's say you only need to sort by day of the month (maybe if month was another table or field). Then you obviously only need to sort the numbers from highest to lowest. Surely ASP has something like the sort() function in PHP. There must be ASP code online dealing with this.
Design usually goes like so: your db schema matters the most, the query the second most, and the sorting the least.

i dont understand. people so talented that they can make a ASP website, but so... lazy? that they cant even make a link to their site.
instead of doing http://mor4wd.com/lbm, you could do
http://mor4wd.com/lb
and that makes the going a lot easier for a lot of people when they look at the site. instead of having to open a whole new webpage just to try and help someone that is too... lazy? to do more a little more to get help, they should just have to hold SHIFT then click.FBI_Agent

Easy there, killer. My concern wasn't for your surfing ease. I'm not here to spam, so I wasn't so freakin' worried about making it easy for you to click over. I figured if you wanted to help me out enough, you wouldn't mind copying and pasting a URL over.
But, I guess you kinda disguised a compliment in that, so... Thanks... I guess...

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |