RE: WoW!!!! SQL is something!

2002-12-05 Thread Norris, Joseph
t: Re: WoW!!!! SQL is something! > I had a problem that required a proper sort of the following: > > IT66 > ITD38 . . . . > ITD100 > ITD101 > ITD102 > ITD103 > ITD104 > ITD105 > > > Because of the different lengths, this was a nightmare for "order by"

RE: WoW!!!! SQL is something!

2002-12-05 Thread Norris, Joseph
Thanks - this is even better - I will give it a try. -Original Message- From: Cal Evans [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 05, 2002 6:19 AM To: Norris, Joseph; Mysql_List (E-mail) Subject: RE: WoW SQL is something! select req_number, right(concat('00&

RE: WoW!!!! SQL is something!

2002-12-05 Thread Cal Evans
select req_number, right(concat('00',trim(req_number)),6) as sort_req, case from req order by sort_req; Haven't tried it but it should work. =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: Norris, Joseph [mailto:[EMAIL PROTECTED]

RE: WoW!!!! SQL is something!

2002-12-05 Thread Gerben Gieling
What you want is the rpad function: http://www.mysql.com/doc/en/String_functions.html RPAD(str,len,padstr) Returns the string str, right-padded with the string padstr until str is len characters long. If str is longer than len' then it will be shortened to len characters. mysql> SELECT RPAD('hi'

RE: WoW!!!! SQL is something!

2002-12-05 Thread Gerben Gieling
Sorry, should be the lpad function: http://www.mysql.com/doc/en/String_functions.html LPAD(str,len,padstr) Returns the string str, left-padded with the string padstr until str is len characters long. If str is longer than len' then it will be shortened to len characters. mysql> SELECT LPAD('hi',

Re: WoW!!!! SQL is something!

2002-12-05 Thread Colin Kettenacker
> I had a problem that required a proper sort of the following: > > IT66 > ITD38 . . . . > ITD100 > ITD101 > ITD102 > ITD103 > ITD104 > ITD105 > > > Because of the different lengths, this was a nightmare for "order by" and so > it led me to my first experiments with case > and I go the followin