delete duplicates SQL

Discussion in 'Troubleshooting' started by ronniead, Mar 31, 2008.

  1. ronniead

    ronniead Member

    Joined:
    Dec 20, 2007
    Messages:
    118
    Hi,

    I have set amember to "not require unique email". I did that, because I don't want every user to get a login and password....what if they decide to purchase later? they have to remember their credentials, or check their email for it....I think it's one more barrier....what do you all think?

    Anyway, here's my real question:

    I want to send an email to all incomplete payment users about using a promotional code. But I don't want my paid users to get that email! How can I delete pending users who have another account which is paid?

    I found his code to search for duplicates:

    SELECT email,
    COUNT(email) AS NumOccurrences
    FROM users
    GROUP BY email
    HAVING ( COUNT(email) > 1 )
    WHERE status < 1

    But doesn't quite help me isolate users who have already paid....

    Any ideas?

    Ronnie

Share This Page