UPDATE FROM portability

From: Andreas Pflug <Andreas(dot)Pflug(at)web(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: UPDATE FROM portability
Date: 2003-03-24 14:30:45
Message-ID: 3E7F1695.5050101@web.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Updating some rows in tab1 with corresponding values from tab2, pgsql style:

UPDATE tab1
SET value=T2.VALUE
FROM tab2 T2
WHERE T2.restr=1
AND tab1.key=T2.key <<<<<<

The same for MSSQL:

UPDATE tab1
SET value=T2.VALUE
FROM tab1 T1
JOIN tab2 T2 ON T1.key=T2.Key <<<<<<
WHERE T2.restr=1

I'm looking for a portable query style, without using a subquery in the
SET clause (which could make things quite slow)
Any hints?

Regards,
Andreas

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-03-24 15:02:02 Re: function with security definer
Previous Message Christoph Haller 2003-03-24 14:22:29 Re: Seeking help with a query....