How to join two tables in postgresql
SELECT t1.Complaint_id,
       t2.currentstatus,
       t2.usertype
FROM firsttable t1
JOIN ( SELECT currentstatus, 
              usertype,
              Parent_id
       FROM ( SELECT Currentstatus,
                     Datetime,
                     Parent_id,
                     usertype,
                     MAX(Datetime) OVER (PARTITION BY Parent_id) AS MaxDatetime
              FROM secondtable
            ) AS derived 
       WHERE Datetime = MaxDatetime
     ) t2 ON t1.Complaint_id = t2.Parent_id
         AND t1.reopen = 1


?

PS. Does secondtable (Parent_id, Datetime) is unique by index/constraint?

PPS. Use CTE to make the query more readable...