RE: How can I isolate the integer part of a varchar field and use it in an ORDER BY?

2006-01-24 Thread Nicolas Verhaeghe
teger part of a varchar field and use it in an ORDER BY? Nicolas Verhaeghe wrote: > Thanks, but unfortunately the replace function does not want to work > on a regexp in version 3.23... or 4.0, or 4.1, or ... > I guess I'll have to create a "displacement" field and popul

Re: How can I isolate the integer part of a varchar field and use it in an ORDER BY?

2006-01-24 Thread Michael Stassen
Nicolas Verhaeghe wrote: Because I am currently stuck with 3.23 I have just decided to create a "displacement" field to isolate the number. That's the right way to go, regardless of version. Besides, some of these bikes escape from the rules, for instance instead of 600 for 600cc, you only ha

Re: How can I isolate the integer part of a varchar field and use it in an ORDER BY?

2006-01-24 Thread Michael Stassen
Nicolas Verhaeghe wrote: Thanks, but unfortunately the replace function does not want to work on a regexp in version 3.23... or 4.0, or 4.1, or ... I guess I'll have to create a "displacement" field and populate it from the admin tool. Well, that's the right way to go. You're seeing the pr

RE: How can I isolate the integer part of a varchar field and use it in an ORDER BY?

2006-01-24 Thread Nicolas Verhaeghe
l the displacement fields will work fine. -Original Message- From: Michael Stassen [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 24, 2006 10:11 PM To: George Law Cc: Nicolas Verhaeghe; mysql@lists.mysql.com Subject: Re: How can I isolate the integer part of a varchar field and use i

Re: How can I isolate the integer part of a varchar field and use it in an ORDER BY?

2006-01-24 Thread Michael Stassen
George Law wrote: Nicolas, Not sure when the "replace" function was introduced into mysql, but I think it might do... REPLACE() exists in 3.23. Use "replace" in your order by, replacing a-z with null chars, leaving just your numeric digits, then order by Easier said than done. select *

RE: How can I isolate the integer part of a varchar field and use it in an ORDER BY?

2006-01-24 Thread George Law
ssage- From: George Law [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 24, 2006 8:14 AM To: Nicolas Verhaeghe; mysql@lists.mysql.com Subject: RE: How can I isolate the integer part of a varchar field and use it in an ORDER BY? Nicolas, Not sure when the "replace" function was int

RE: How can I isolate the integer part of a varchar field and use it in an ORDER BY?

2006-01-24 Thread Nicolas Verhaeghe
-- From: George Law [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 24, 2006 8:14 AM To: Nicolas Verhaeghe; mysql@lists.mysql.com Subject: RE: How can I isolate the integer part of a varchar field and use it in an ORDER BY? Nicolas, Not sure when the "replace" function was introduce

RE: How can I isolate the integer part of a varchar field and use it in an ORDER BY?

2006-01-24 Thread George Law
ilto:[EMAIL PROTECTED] Sent: Tuesday, January 24, 2006 9:13 AM To: 'Gleb Paharenko'; mysql@lists.mysql.com Subject: RE: How can I isolate the integer part of a varchar field and use it in an ORDER BY? Oh yeah, I forgot to tell... I still use 3.23. Cannot upgrade for the moment. So no SP..

RE: How can I isolate the integer part of a varchar field and use it in an ORDER BY?

2006-01-24 Thread Nicolas Verhaeghe
Subject: Re: How can I isolate the integer part of a varchar field and use it in an ORDER BY? Hello. The "brute force" way is to create and UDF or store function which can extract the numeric part from the string and ORDER BY the results of this function. See: http://dev.mysql.com/doc/ref

Re: How can I isolate the integer part of a varchar field and use it in an ORDER BY?

2006-01-24 Thread Gleb Paharenko
Hello. The "brute force" way is to create and UDF or store function which can extract the numeric part from the string and ORDER BY the results of this function. See: http://dev.mysql.com/doc/refman/5.0/en/adding-functions.html http://dev.mysql.com/doc/refman/5.0/en/stored-procedures.html ht

How can I isolate the integer part of a varchar field and use it in an ORDER BY?

2006-01-23 Thread Nicolas Verhaeghe
A client of mine sells motorcycle parts and the motorcycle models are for instance: YZ85 YZ125 WRF450 YZF450 Etc... If you know motorcycles, you know that the number is always the displacement in cc. What I am looking to do here is make it so that the models are sorted properly according to the