• Anonymous User 1437452

    (@anonymized-1437452)


    Hello everyone

    Its a MySQL related question.

    Is there any command to find out all wordpress topics which contain first comment by a particular person?

    I mean suppose I want to find out all topics which contain first comment by a person with name “xyz” or with email ID “xyz@abc.com”.

    Can it be done?

    Any kind of help would be highly appreciated.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The SQL query below should be close to what you want:

    $author = 'rupert';
    $sql = "
    SELECT p.*,c1.* FROM wp_posts p
    JOIN wp_comments c1 ON (c1.comment_post_ID = p.ID)
    WHERE c1.comment_author = '$author'
    AND c1.comment_date = (SELECT min(c2.comment_date)
       FROM wp_comments c2
       WHERE c2.comment_post_ID = c1.comment_post_ID)
    AND p.post_type = 'post'
    AND p.post_status = 'publish'";
    Thread Starter Anonymous User 1437452

    (@anonymized-1437452)

    ^^ Awesome. Thank you my friend. Worked like a charm. Just what I wanted. 😀

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘MySQL Query to Find Topics with First Comment by a Particular Person’ is closed to new replies.