me@privacy.net wrote:
> hi,
>
> how would I query my table to return only the records where the field
> 'mobile' has a valid mobile telephone number.
>
> Valid being.. begining 07 and being 11 characters in length.
>
> many thanks,
>
> Dave
>
>
You can use a regular expression:
select ... WHERE phone_column REGEXP '^07[[:alnum:]]{9}$';
meaning: a string beginning with '07', followed by exactly
9 alphanumeric characters. If they need to be digits, use :digit:
instead of :alnum:.
References here:
http://dev.mysql.com/doc/refman/5.0/en/regexp.html
ciao
gmax
--
_ _ _ _
(_|| | |(_|><
_|
http://gmax.oltrelinux.com