BEGIN; UPDATE api.vods SET thumbnail_id = links.b_2_file_id FROM api.vods_thumbnail_links links WHERE api.vods.id = links.vod_id; COMMIT;