mysql - If else on WHERE clause -
i've query:
select `id` , `naam` `klanten` ( `email` '%@domain.nl%' or `email2` '%@domain.nl%' ) but want this:
select `id` , `naam` `klanten` if(`email` > 0, `email` '%@domain.nl%' , `email2` '%@domain.nl%' ) how check if email exist? want use email , if field empty want use email2. how accomplish this?
if used select field, like clause placed after it:
select `id` , `naam` `klanten` if(`email` != '', `email`, `email2`) '%@domain.nl%'
Comments
Post a Comment