php - SQL Query If Statement? -
i have 2 fields in legacy database. want query 1 of them, null
, in case there if
statement like if field_a !== null { field_a='value' } else { field_b='value' }
my question is, there way in sql or have 2 queries, 1 check if null, if statement in logic?
i think can capture logic this:
where field_a = 'value' or (field_a null , field_b = 'value')
or more as:
where field_a = 'value' or field_b = 'value'
Comments
Post a Comment