Skip to content
Advertisement

MySQL Where condition with CASE

WHERE CASE WHEN cksp.status IS NOT NULL THEN ckspc.is_include_in_pipeline = 1 
      ELSE 1=1 
      END

Here i want like if cksp.status is not null then condition should be cksp.is_include_in_pipeline = 1 ELSE ignore the where condition

Advertisement

Answer

That logic should be similar to:

(cksp.status IS NOT NULL and ckspc.is_include_in_pipeline = 1) or cksp.status IS NULL
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement