Re: Number extraction from a string

2006-12-08 Thread Philip Mather
Chris, On Thursday 07 December 2006 16:34, Ed Reed wrote: Thanks for the quick reply Chris. It's close but it's a little off. Your example also returns all instances that where the letter N exists in another words as well SELECT SUBSTRING(value,2) as value_num, value FROM num_test

Re: Number extraction from a string

2006-12-08 Thread Chris White
On Friday 08 December 2006 01:57, Philip Mather wrote: You'll need a regex, see these... http://dev.mysql.com/doc/refman/4.1/en/pattern-matching.html http://dev.mysql.com/doc/refman/4.1/en/string-comparison-functions.html http://dev.mysql.com/doc/refman/4.1/en/regexp.html Yes, you could use a

Re: Number extraction from a string

2006-12-08 Thread Ed Reed
Is there anyway to use RegExp in a field parameter? What would be great is if I could do this, SELECT Trim(Both RegExp '[a-z]' From value) as value_num, value FROM num_test WHERE value REGEXP 'N[1-999]'; The biggest problem is trying to find the position of where the number starts in the string

Number extraction from a string

2006-12-07 Thread Ed Reed
Can someone help me with this? I have a text field that sometimes contains a number preceded with the letter N. So it might look like this A test N60 or N45 someother text or This happened. N122, Then there was this. I need to come up with a Select statement that can show me all the

Re: Number extraction from a string

2006-12-07 Thread Chris White
On Thursday 07 December 2006 14:57, Ed Reed wrote: Can someone help me with this? quick hack, but it works from what you've stated: mysql create table num_test (id SERIAL PRIMARY KEY, value VARCHAR(256)); Query OK, 0 rows affected (0.07 sec) mysql insert into num_test (value) VALUES

Re: Number extraction from a string

2006-12-07 Thread Ed Reed
Thanks for the quick reply Chris. It's close but it's a little off. Your example also returns all instances that where the letter N exists in another words as well Do you know of a way to prevent that? Thanks again Chris White [EMAIL PROTECTED] 12/7/06 3:11 PM On Thursday 07 December 2006

Re: Number extraction from a string

2006-12-07 Thread Chris White
On Thursday 07 December 2006 16:34, Ed Reed wrote: Thanks for the quick reply Chris. It's close but it's a little off. Your example also returns all instances that where the letter N exists in another words as well SELECT SUBSTRING(value,2) as value_num, value FROM num_test WHERE value like