Suppose you have a wordpress blog and you want to send a email to say ‘thank you’ to all the people who left good comments (you approved them). You need a list of emails.
The following SQL does the job. It will return distinct emails (no duplicate).
SELECT distinct `comment_author`, `comment_author_email` FROM `wp_comments` WHERE `comment_author_email` <> '' and `comment_author` <> '' and `comment_approved` = 1;
The result looks like this:
–EOF (The Ultimate Computing & Technology Blog) —
Last Post: Javascript Function To Jump Out Of The Frame
Next Post: Ternary Operator and Boolean