I need to pull all the records from the database that belong to the same group. Say for instance the same country.
I only want to call the records that have at least one value filled in among two different fields. Lets say Home and Work Email addresses as the fields. They need to have at least one email between them both otherwise I want to forget about them and move to the next.
What is the best way to perform this mysql call?
I've been doing it this way but I'm running into problems:
SELECT email,h_email FROM demographics WHERE country='United States' AND email LIKE '%@%' OR h_email LIKE '%@%'
The problem I'm getting is that I don't get only countries from US but others from the database as well. And I'm not completely sure if I'm getting all those with emails.
I'm all ears if someone has a better call for this query.
Thanks