From: | Christoph Haller <ch(at)rodos(dot)fzk(dot)de> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Cc: | Andreas(dot)Pflug(at)web(dot)de |
Subject: | Re: UPDATE FROM portability |
Date: | 2003-03-26 10:27:14 |
Message-ID: | 3E818082.FFE8E2C7@rodos.fzk.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?
>
In postgres this should work as well
UPDATE tab1
SET value=tab2.VALUE
WHERE tab2.restr=1
AND tab1.key=tab2.key
I have to admit I don't know nothing about mssql,
so I have no idea if this is of any real help.
Regards, Christoph
From | Date | Subject | |
---|---|---|---|
Next Message | Tomasz Myrta | 2003-03-26 11:29:14 | Re: order by |
Previous Message | Tomasz Myrta | 2003-03-26 10:05:23 | Re: Does anyone use TO_CHAR(INTERVAL)? |