Updating rows in PosgreSQL using Subquery

Example Updating rows in PosgreSQL using Subquery:

UPDATE master_prpks SET pic_department_id = subquery.dept_id
FROM (SELECT a.id as id, b.master_department_id as dept_id FROM master_prpks a JOIN master_users b ON a.user_non_it_id = b.id) as subquery
WHERE master_prpks.id = subquery.id

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s