Last active
August 1, 2022 07:47
-
-
Save YiLi225/a91f5651b3b7194bd5b20a7922dbe3bb 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
--- However, COALESCE() NOT WORK for Empty or NA string, instead, use CASE WHEN | |
SELECT | |
ID_VAR, | |
EMPTY_STR_VAR, | |
COALESCE(EMPTY_STR_VAR, 'MISSING') AS COALESCE_EMPTY_STR_VAR, | |
CASE WHEN EMPTY_STR_VAR = ' ' THEN 'EMPTY_MISSING' END AS CASEWHEN_EMPTY_STR_VAR, | |
NA_STR_VAR, | |
CASE WHEN NA_STR_VAR = 'NA' THEN 'NA_MISSING' END AS CASEWHEN_NA_STR_VAR | |
FROM | |
CURRENT_TABLE | |
ORDER BY ID_VAR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment