My query looks basically like
WITH DATA AS(
SELECT fields
FROM table
WHERE [many conditions]
AND NOT field1 = 'string'
)
SELECT foo,
bar,
CASE
WHEN field1 IS NULL THEN 'other_string'
[other cases]
END
FROM data
There's plenty of other stuff going on, but this is the core bit that isn't working. This should give me plenty of results. but instead, that particular case has zero results; if i cut out the rest of the query and run basically just this, it's just an empty table.
AND NOT field1 = 'string'
seems to be filtering out all rows where field1 is 'string', but ALSO all rows where field1 is null. If field1 is null, then field1 = 'string'
should evaluate false (since null doesn't equal anything) and therefore NOT field1 = 'string'
should evaluate true and those rows should be in the query—right?
Not actually sure what sql implementation is running behind the Redash frontend I'm using but I can find out if it's relevant.