elsenorjose
Technical User
In my table I have a field called market which is a geographical location like Los Angeles, Miami, etc. The values are stored like this:
LOSANGELES-CA
LITTLEROCK-AR
LONGISLAND-NY
I am trying to CASE this field so that 'valid' markets are displayed but invalid values and missing values are labeled as such. This snippet of SQL is what I'm using to check for the '-' between city and state
My problem is that the way our logs are processed, NULL values are converted to '-'. So...my code will treat those '-' as legitimate market IDs and display them. I want those to go into the 'missing values' bucket.
How would I code my query so that if there is nothing before or after a '-', then treat it as a missing value?
Thanks
LOSANGELES-CA
LITTLEROCK-AR
LONGISLAND-NY
I am trying to CASE this field so that 'valid' markets are displayed but invalid values and missing values are labeled as such. This snippet of SQL is what I'm using to check for the '-' between city and state
Code:
select case when market regexp '-' then market
else 'invalid value'...
My problem is that the way our logs are processed, NULL values are converted to '-'. So...my code will treat those '-' as legitimate market IDs and display them. I want those to go into the 'missing values' bucket.
How would I code my query so that if there is nothing before or after a '-', then treat it as a missing value?
Thanks