Unintended behavior: Substraction between null values end in '0'
When either one of the field is NULL, I want the returned value to be NULL
as well. I have also tried reversing the logic: is not null. Still the
same results.
MySQL code:
(case
when
((`creative_stg_sample_tracking_raw`.`total_samples_received`
is not null)
and
(`creative_stg_sample_tracking_raw`.`total_samples_forecasted`
is not null))
then
(cast(`creative_stg_sample_tracking_raw`.`total_samples_received`
as signed) -
cast(`creative_stg_sample_tracking_raw`.`total_samples_forecasted`
as signed))
else NULL
end) AS `received_forecasted_dif`
Screenshot:
No comments:
Post a Comment