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

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -