Jump to content

Recommended Posts

Hi all,

Thanks for taking a look at this thread. I have a database query that retuens the results correctly, but i need to do an order by clause. When i do this it displays numbers before letters, whereas i need to display letters then number e.g

Jobcard No Page No.
PRE001 page 1
PRE002 page 1
POS001 page 1
POS001 page 2
POS002 page 1
455101 page 1
455101 page 2
455101 page 3
567070 page 1 etc, etc, etc,

the field Jobcard No. is a Varchar i think i need to changed to asci and Order By that way. I'm not sure though, any ideas??? Thanks for any help, advice, thoughts in advance.

Kind Regards,


Steven
Link to comment
https://forums.phpfreaks.com/topic/7720-order-by/
Share on other sites

could you not have an additional field in your table named "is_numeric" or something?

This way you could just run two queries...

select * from your_table where is_numeric=0

//show the results

then

select * from your_table where is_numeric=1


You could have a script running on the variable before its inserted into the database to decide whether it contains any non numeric characters or not.
Link to comment
https://forums.phpfreaks.com/topic/7720-order-by/#findComment-28191
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.