• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 88
  • Last Modified:

Query Database For Table - Email that has a blank, missing, or no data

I have a membership database.  One of the fields is "Email".  That field CAN be blank.  I'd like to query the database and find all member records with no data in the Email field.  That we can reach out to those members and ask them to update their e-mail address.

SQL database.  Thank you.
0
derrickisonline
Asked:
derrickisonline
1 Solution
 
zephyr_hex (Megan)DeveloperCommented:
It's not entirely clear what you're looking for... but to find blank or NULL Email records, you would do:

SELECT * from MyTable WHERE Email IS NULL OR Email = ''

Open in new window

0
 
derrickisonlineAuthor Commented:
You stated you didn't know what I was looking for, but that was exactly it.  I just needed to know which records had a missing email address field.  That way we can reach out and have members update their email addresses.  

Thank you!
0
 
awking00Commented:
Slight variation -
SELECT * from MyTable WHERE ISNULL(Email,'') = ''
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Russ SuterCommented:
I might slightly enhance what is above to perform at least a rudimentary search for a valid email address.
SELECT * FROM myTable WHERE Email IS NULL OR Email NOT LIKE '%_@__%.__%'

Open in new window

This at least guarantees that the email address will have a minimum of a single "@" and a single "."
This query would return empty, blank, and invalid email addresses.
0
 
derrickisonlineAuthor Commented:
One more thing, can you tell me how to use the query you provided but drilling down again buy saying Membership Status = Active?
0
 
zephyr_hex (Megan)DeveloperCommented:
SELECT * from MyTable WHERE (Email IS NULL OR Email = '') AND [Membership Status] = 'Active'

Open in new window

1
 
derrickisonlineAuthor Commented:
Thanks again!
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now