SQL Question - custom_field_value is empty but not null
I've added custom_field_value16 to one of my ticket queues. It is hidden from ticket submitters and ticket owners. Based on an action in the ticket I drop a timestamp in the field. The intent is to check this field for the presence of the timestamp (because it's not always suppose to be present) and if it is present, use it in place of a system placed timestamp in another field.
In trying to query for the timestamp value I'm running into a problem where there is no timestamp present in custom_field_value16 but the field doesn't "= IS NOT NULL" because it is an empty string value as in = '' (two single quotes). I was trying to use ifnull(expr1,expr2) in my query but it doesn't return all of the rows where custom_field_value16 doesn't have a timestamp.
Question: Is there a suitable replacement to ifnull? I have tried using CASE WHEN () THEN () but it becomes very convoluted and doesn't provide accurate results.
In trying to query for the timestamp value I'm running into a problem where there is no timestamp present in custom_field_value16 but the field doesn't "= IS NOT NULL" because it is an empty string value as in = '' (two single quotes). I was trying to use ifnull(expr1,expr2) in my query but it doesn't return all of the rows where custom_field_value16 doesn't have a timestamp.
Question: Is there a suitable replacement to ifnull? I have tried using CASE WHEN () THEN () but it becomes very convoluted and doesn't provide accurate results.
1 Comment
[ + ] Show comment
Answers (0)
Please log in to answer
Be the first to answer this question
filter line 1: does not begin with '' or does not contain ''
or
filter line 2: is not null - SMal.tmcc 10 years ago
Thanks again - jmarotto 10 years ago