Doh ..

Maybe ..

select age from Ages where left(age,1) > 0 and right(age,1) > 0;

This is assuming the age is 2 letters wide and tests each one to be numeric :�)

Table:

+-------+
| age   |
+-------+
| hello |
| 55    |
| 50+   |
| 1     |
| cat1  |
+-------+

Returns:

+------+
| age  |
+------+
| 55   |
| 1    |
+------+ 


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 25 August 2004 15:36
To: [EMAIL PROTECTED]
Subject: RE: [ cf-dev ] MySQL Select Numeric


I'd tried selecting
WHERE Age > 0
AND Age < 99

But this still gave me things like '50+'




                                                                                       
                                  
                    "Stephen Pope"                                                     
                                  
                    <[EMAIL PROTECTED]        To:     <[EMAIL PROTECTED]>              
                       
                    rv.org.uk>                 cc:                                     
                                  
                                               Subject:     RE: [ cf-dev ] MySQL 
Select Numeric                          
                    25/08/2004 15:32                                                   
                                  
                    Please respond to                                                  
                                  
                    dev                                                                
                                  
                                                                                       
                                  
                                                                                       
                                  




You could try selecting where Age is greater than 0 .. That should give you a number 
(in theory not tried it)

The RegExp one will work too (but can be a little 'expensive' if you are doing a lot 
of queries.

e.g.
SELECT * FROM Ages WHERE Age 0 > 0;

Regards

Stephen

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: 25 August 2004 14:56
To: [EMAIL PROTECTED]
Subject: [ cf-dev ] MySQL Select Numeric

Any way in MySQL to select rows where a value is or can be converted to a number?

sort of like:

SELECT Age
FROM Ages
WHERE IsNumeric(Age)

My best workaround so far seems to be just do the select as normal, then loop through 
the list, removing rows where "NOT IsNumeric(query.Age)".


--
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by
gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]


--
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by
gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]






--
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]


--
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]

Reply via email to