Solved

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

Posted on 2016-10-20
7
54 Views
Last Modified: 2016-11-02
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
Comment
Question by:derrickisonline
7 Comments
 
LVL 42

Accepted Solution

by:
zephyr_hex earned 500 total points
ID: 41852302
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
 

Author Closing Comment

by:derrickisonline
ID: 41852325
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
 
LVL 31

Expert Comment

by:awking00
ID: 41852330
Slight variation -
SELECT * from MyTable WHERE ISNULL(Email,'') = ''
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 20

Expert Comment

by:Russ Suter
ID: 41852334
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
 

Author Comment

by:derrickisonline
ID: 41852360
One more thing, can you tell me how to use the query you provided but drilling down again buy saying Membership Status = Active?
0
 
LVL 42

Expert Comment

by:zephyr_hex
ID: 41852676
SELECT * from MyTable WHERE (Email IS NULL OR Email = '') AND [Membership Status] = 'Active'

Open in new window

1
 

Author Comment

by:derrickisonline
ID: 41870407
Thanks again!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now