How to update two tables using subquery in postgresql? I have two tables 

main table is

Complaintid Status  Templateid
123           2 
135           5      2
142           5      8
143           3 
145           5 


Second table

Parent_complaint_id Currentstatus   Reopen  Photo
123                     0             0     Abc.jpg
123                     2             0     Abc.jpg
135                     5             0     Xyz.jpg
142                     5             0     Sim.jpg
143                     3             0     123.jpg
145                     2             0     Ing.jpg
145                     5             0     Ing.jpg


After updation first table

Complaintid Status  Templateid
123          2  
135          1       2
142          1       8
143          3  
145          5  


After updation second table

Parent_complaint_id Currentstatus   Reopen  Photo
123                  0                0     Abc.jpg
123                  2                0     Abc.jpg
135                  1                0     Xyz.jpg
142                  1                0     Sim.jpg
143                  3                0     123.jpg
145                  2                0     Ing.jpg
145                  5                0     Ing.jpg


Here is the first query  

Update complaints 
set status='1' 
where templateid is not null 


but i don't know how to add subquery in above query
For example

UPDATE second_table
SET Currentstatus = 1
WHERE EXISTS ( SELECT 1
               FROM first_table
               WHERE first_table.Complaintid = second_table.Parent_complaint_id
                 AND first_table.templateid is not null )


Or

UPDATE second_table
SET Currentstatus = 1
FROM first_table
WHERE first_table.Complaintid = second_table.Parent_complaint_id
  AND first_table.templateid is not null


Or ... too many variants.