Jump to content


Photo

ORDER BY


  • Please log in to reply
3 replies to this topic

#1 stebut05

stebut05
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 18 April 2006 - 01:52 PM

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

#2 wisewood

wisewood
  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 18 April 2006 - 02:01 PM

ORDER BY jobcard DESC

?? Or is that too easy?
wisewood: proven fact, I am both wise, and wooden.

#3 stebut05

stebut05
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 18 April 2006 - 02:10 PM

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

#4 wisewood

wisewood
  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 18 April 2006 - 03:05 PM

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.
wisewood: proven fact, I am both wise, and wooden.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users