• Here’s my dilemma:

    I’m running a custom install script, borrowed heavily from WP’s, that dumps the extra fields into the wp_usermeta table, e.g. whether they want to receive the newsletter.

    So, when I go to get their information in csv to import into pommo (which rocks, by the way!), I want to use a query like this one, but can’t phrase it properly, and phpmyadmin is so much of a dinosaur, I don’t want to peruse the database for hours collecting the information by hand.

    This is what I have so far:

    SELECT user_id FROM wp_usermeta WHERE meta_key = “newsletter”;
    — this top part works fine. I know the next part is completely ridiculous in how wrong it is, but I can’t phrase it properly.—

    FOR EACH user_id[which I just got] SELECT user_email

    —this next part also is fine—
    INTO OUTFILE ‘/path/to/file/email_list.csv’
    FIELDS TERMINATED BY ‘,’ ENCLOSED BY ‘”‘
    LINES TERMINATED BY ‘\n’
    FROM wp_users;

    Any help would be greatly appreciated!!

  • The topic ‘MySQL query problem’ is closed to new replies.