pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Pflug <Andreas.Pflug@web.de>
To: pgsql-sql@postgresql.org
Subject: UPDATE FROM portability
Date: Mon, 24 Mar 2003 15:30:45 +0100
Message-ID: <3E7F1695.5050101@web.de> (raw)

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




view thread (4+ messages)  latest in thread

Message-ID: <3E7F1695.5050101@web.de>
Permalink:  ../3E7F1695.5050101@web.de/
Also on:    postgresql.org/message-id/3E7F1695.5050101@web.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: Andreas.Pflug@web.de
  Subject: Re: UPDATE FROM portability
  In-Reply-To: <3E7F1695.5050101@web.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox