Good Morning,

I have an ever growing member database that is currently at around 6000 (developed over the past 2 weeks), and expect it to be in the hundreds of thousands within a few more weeks...

My problem is that alot of members are using a single email address for multiple members, and I would like to limit the emails that we send out to just 1 per email address to save on the email load and time...

Here is my query:

SELECT user, pass, email
        FROM members
        WHERE mem_status <>'T'
        ORDER BY email asc";

What do I need to do to not send multiple emails to the same address...

Thank you in advance for your feedback.

I'm sure it is something simple that I should know, but I'm finding every day that there is alot I still don't know about programming, expecially when it comes to MySql...

Douglas

If you are trying to target the unique email accounts, rather than the user, then change your query to something like:

SELECT distinct(email)
FROM members
WHERE mem_status <>'T'

This query will only provide you with a result of unique email addresses.

or

SELECT user, pass, email, count(*) as `num_accounts`
        FROM members
        WHERE mem_status <>'T'
        GROUP BY email
        ORDER BY email asc";

Biiim,

Thank you... That was exactly the answer I was looking for, and in reality, I should have known the answer.

I appreciate your response, and adding the count was a great idea, as I am implementing that into the email that is being sent telling them that the single email cover all XXX accounts that they have listed under the single email address.

Thanks again,

Douglas

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.