Jump to content

Sorting output


aeris130

Recommended Posts

Here's my query:

[code]SELECT * FROM table WHERE column LIKE \"%$trimmed%\" AND approved='yes'
  ORDER BY number ASC[/code]

"number", is a column that stores a certain number (VARCHAR 10, other then ID) that's unique. These numbers range from 1 to 999. The problem is, that the results are sorted based on the first digit, not the entire number.

Say I have these numbers: 1, 2, 4, 8, 9, 25, 88, 106 and 305.

The results get sorted like this:
[code]
1

106

2

25

305

4

8

88

9[/code]

But I want to store them in the correct order (1, 2, 4, 8, 9, 25, 88, 106 and 305).

How do I solve this?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.