Problem with REPLACE

Here’s my code:
SELECT TRIM(CONCAT_WS(’ ',hn,hn_suf,dir,sn,type,suf)) AS addr
REPLACE(addr," “,” ")
FROM vot13
WHERE zip = ‘68502’
GROUP BY addr
INTO OUTFILE ‘c:/users/desktop/geo2.csv’
FIELDS TERMINATED BY ‘,’
ENCLOSED BY ‘"’
LINES TERMINATED BY ‘\n’

This script returns a parse error.

What’s the right way to use REPLACE? This script executes successfully when I remove REPLACE.

Please excuse me. Obviously it’s the double quotes.

That still doesn’t look right. The replace should be part of the original select, shouldn’t it?

SELECT REPLACE(TRIM(CONCAT_WS(' ',hn,hn_suf,dir,sn,type,suf)), 'string1', 'string2') AS addr

Point well taken!

Thank-you very much DaveMaxwell.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.