Jump to content

jsoni

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by jsoni

  1. In Question and Answer system I am trying to get comment for question and answer and the title of that comment.

    I have done so far and getting comment's content but now the issue is if the comment is on the answer it is not getting the question title. So how can I write query so it will get all comment from question and answer both and will get the title of the question.

    Here I have done so far.

    SELECT c.postid, p.title, c.type, c.userid, c.content, c.parentid, u.handle, u.email, u.avatarblobid, u.avatarwidth, u.avatarheight FROM qa_posts p
    JOIN qa_posts c ON (p.postid = c.parentid)
    LEFT JOIN qa_users u ON c.userid = u.userid
    WHERE c.type = 'C'
    AND p.flagcount = 0
    ORDER BY c.postid DESC
    LIMIT 5
    

    Here is my tables image

     

    ZSuev.jpg

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.