UPDATE REGEX MYSQL

Posted by Simon on Stack Overflow See other posts from Stack Overflow or by Simon
Published on 2010-03-24T12:14:49Z Indexed on 2010/03/24 12:33 UTC
Read the original article Hit count: 366

Filed under:

I have a table of contacts and a table of postcode data.

I need to match the first part of the postcode and the join that with the postcode table... and then perform an update...

I want to do something like this...

UPDATE `contacts` LEFT JOIN `postcodes` ON PREG_GREP("/^[A-Z]{1,2}[0-9][0-9A-Z]{0,1}/", `contacts`.`postcode`) = `postcodes`.`postcode` SET `contacts`.`lat` = `postcode`.`lat`, `contacts`.`lng` = `postcode`.`lng`

Is it possible?? Or do I need to use an external script?

Many thanks.

© Stack Overflow or respective owner

Related posts about mysql