[V4RB] - CONCAT in WHERE-clause

Ruslan Zasukhin sunshine at public.kherson.ua
Sun Jul 3 12:39:50 CDT 2005


On 7/3/05 12:30 PM, "Erik Scholtz" <anomar at elitecoderz.net> wrote:

Hi Erik,

> I have to do a very ugly SQL-Query on a database with telephone-numbers
> (formated like: 030/22256489 or 0302/2256489 , ...):
> 
> *********
> 
> SELECT id
> FROM usersdata
> WHERE
> CONCAT(
> LPAD(phone,LOCATE('/',phone)-1,''),
> SUBSTRING(phone,LOCATE('/',phone)+1)
> )='03022256489'
> *********
> 
> Since I do not know where the / in the phone-number is and if it is set
> correctly, I have to remove the / in the query and look for the complete
> number without any other chars exept the digits.
> 
> Unfortunatly, Valentina seems not to understand the CONCAT-command in
> the where-clause or did I do something wrong?

I recommend you to use Table Method for this task
    because main advantage -- you can build index for it.

So make new method field in table with formula, and mark it indexed.

Then do search as

    where fldMEthod = '03022256489'



-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list