[thelist] mysql query - replacing characters

James O'Donnell jimmyropes at gmail.com
Tue Aug 4 05:12:33 CDT 2009


Why do you add a space in the concat and then remove it in the replace?

-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Jeremy Weiss
Sent: Tuesday, 04 August, 2009 04:10
To: Evolt
Subject: [thelist] mysql query - replacing characters

I'm trying to write a query that will combine two fields and then remove all
non-letter and non-number characters. 

SELECT unique_id,
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(CONCAT(street_num,' ',
street_name),' ',''),'-',''),'/',''),'#',''),'.','') AS address FROM
listings HAVING address LIKE '%123EasySt%'

Now, this works up to what I have there. But, if I try to add an additional
REPLACE to it, it kicks up an error saying something's wrong with my syntax.

I guess my first question is, is there a better way to write this query? And
if not, why won't it accept more nested replace statements?

Thanks.

-jeremy



-- 

* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.392 / Virus Database: 270.13.41/2277 - Release Date: 08/02/09
05:56:00




More information about the thelist mailing list