フィールドのいずれかが の場合NULL
、戻り値NULL
も同様にしたい。ロジックを逆にしてみました: is not null
. それでも同じ結果です。
MySQL コード:
(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`
スクリーンショット: