Welcome to Questionaries, where you can ask questions and receive answers from other members of the community.

Let us know at info@questionaries.org

check for NULL value in MySql query

8 like 0 dislike
Can any one please let me know the best way to use IF statement in mysql query to show if the "email" field is NULL then it should show as "no email"...

Postcode    Telephone             Email
----------------------------------------------------------
BS20 0QN    1275373088         no email
BS20 0QN    1275373088         no email
PO9 4HG 023 92474208        prabhu1@vacmedia.com
SO43 7DS    07801 715200       test@vacmedia.com
----------------------------------------------------------
asked 2 years ago by eagle09 (95,490 points)

1 Answer

1 like 0 dislike
Use the COALESCE function:

COALESCE(Email, 'no email')
answered 2 years ago by marck_don (191,010 points)

Related questions

7 like 0 dislike
1 answer
13 like 1 dislike
1 answer
asked 2 years ago by SeO (39,810 points)
8 like 0 dislike
0 answers
asked 2 years ago by eagle09 (95,490 points)
8 like 0 dislike
1 answer
asked 2 years ago by eagle09 (95,490 points)
9 like 0 dislike
0 answers