Last active
September 10, 2021 03:06
-
-
Save snelson82/ae9d681031c8acdac4b81abbd7507fc3 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
-- Mixed with CASE, this will extract the float/digits in the last set of `()` in the string | |
CASE WHEN string_to_chop LIKE '%(%-%)%' THEN | |
NULL | |
ELSE | |
NULLIF (REPLACE(REPLACE(REGEXP_SUBSTR (string_to_chop, '\\([[:digit:]]+.[[:digit:]]+\\)$|\\([[:digit:]]+\\)$'), '(', ''), ')', ''), '')::float | |
END AS chopped_string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment