I want to do a select and update in a single query in postgre sql 9.4. I used below command for that
UPDATE (SELECT t2.pid, t1.pid as newid FROM table1 AS t1