PostgreSQL – For

[code type=sql]
DO
$do$
BEGIN
FOR i IN 1..100000 LOOP
UPDATE checklist_headers SET area_name = (SELECT name FROM areas WHERE id = (SELECT area_id FROM checklist_headers WHERE id = i)) WHERE id = i;
END LOOP;
END
$do$;

Share and Enjoy !

0Shares
0 0