Jump to content

Archived

This topic is now archived and is closed to further replies.

stebut05

ORDER BY

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

Share this post


Link to post
Share on other sites
That will do the following

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

So the answer to your question, too easy and i wish....lol

Regards,

Steven

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

×

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.