Created
December 17, 2015 21:57
-
-
Save robins35/92e42463a376bac899bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE listings | |
SET price = CAST( | |
REGEXP_REPLACE( | |
REGEXP_REPLACE( | |
REGEXP_REPLACE(details.value, 'k$|K$', '000', 'g'), | |
'\.[0-9]{2}$', '', 'g'), | |
'[^0-9]', '', 'g') | |
AS money) | |
FROM details | |
WHERE details.detailable_type = 'Listing' | |
AND details.detailable_id = listings.id | |
AND details.name = 'price'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment