UPDATE with table join

From: Tarlika Elisabeth Schmitz <postgresql(at)numerixtechnology(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: UPDATE with table join
Date: 2008-05-27 15:53:05
Message-ID: 20080527165305.550c3d78@dick.coachhouse
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I need to update some records in a table depending on values in another
table:

UPDATE
item SET export_time = now()
WHERE item_pk IN
(
SELECT
item.item_pk AS pk
FROM ITEM
LEFT JOIN product product ON Item.product_fk = product.product_pk
WHERE product.xyz = 't' AND ...
)

Is this the most efficient way of doing this?
Is there a limit to the number of results that IN can cope with?

This needs to run on Postgres 7.4.

--

Best Regards,

Tarlika Elisabeth Schmitz

A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?

Browse pgsql-sql by date

  From Date Subject
Next Message Harald Fuchs 2008-05-27 16:08:13 Re: Enumerated (enum) types
Previous Message Michael Lourant 2008-05-27 14:29:27 Enumerated (enum) types