[V4RB] - CONCAT in WHERE-clause

Erik Scholtz anomar at elitecoderz.net
Sun Jul 3 11:30:08 CDT 2005


Hello,

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?

Thanks for your hints,
Erik



More information about the Valentina mailing list