Re: [GENERAL] How to use outer join in update

2006-12-08 Thread Tom Lane
Ragnar <[EMAIL PROTECTED]> writes: > On fös, 2006-12-08 at 10:09 +0100, Alban Hertroys wrote: >> Andrus wrote: >>> update t1 set f1=t2.f3 from t1 left join t2 on t1.f2=t2.f4 >> >> That looks like a self-join on t1 without using an alias for the second >> instance of t1. >> >> I think you meant:

Re: [GENERAL] How to use outer join in update

2006-12-08 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Alban Hertroys <[EMAIL PROTECTED]> writes: > Andrus wrote: >> In my current DBMS I can use >> >> create table t1 ( f1 int, f2 int ); >> create table t2 ( f3 int, f4 int ); >> update t1 set f1=t2.f3 from t1 left join t2 on t1.f2=t2.f4 > That looks like a self-join

Re: [GENERAL] How to use outer join in update

2006-12-08 Thread Ragnar
On fös, 2006-12-08 at 10:17 +, Ragnar wrote: > On fös, 2006-12-08 at 10:09 +0100, Alban Hertroys wrote: > > Andrus wrote: > > > In my current DBMS I can use > > > > > > create table t1 ( f1 int, f2 int ); > > > create table t2 ( f3 int, f4 int ); > > > update t1 set f1=t2.f3 from t1 left join

Re: [GENERAL] How to use outer join in update

2006-12-08 Thread Ragnar
On fös, 2006-12-08 at 10:09 +0100, Alban Hertroys wrote: > Andrus wrote: > > In my current DBMS I can use > > > > create table t1 ( f1 int, f2 int ); > > create table t2 ( f3 int, f4 int ); > > update t1 set f1=t2.f3 from t1 left join t2 on t1.f2=t2.f4 > > That looks like a self-join on t1 witho

Re: [GENERAL] How to use outer join in update

2006-12-08 Thread Shoaib Mir
You can use a view for that join query and then create a rule over it to insert in the referenced tables for the inserts in view. Thanks, Shoaib On 12/8/06, Alban Hertroys <[EMAIL PROTECTED]> wrote: Andrus wrote: > In my current DBMS I can use > > create table t1 ( f1 int, f2 int ); > create t

Re: [GENERAL] How to use outer join in update

2006-12-08 Thread Alban Hertroys
Andrus wrote: > In my current DBMS I can use > > create table t1 ( f1 int, f2 int ); > create table t2 ( f3 int, f4 int ); > update t1 set f1=t2.f3 from t1 left join t2 on t1.f2=t2.f4 That looks like a self-join on t1 without using an alias for the second instance of t1. I think you meant: upda

[GENERAL] How to use outer join in update

2006-12-07 Thread Andrus
In my current DBMS I can use create table t1 ( f1 int, f2 int ); create table t2 ( f3 int, f4 int ); update t1 set f1=t2.f3 from t1 left join t2 on t1.f2=t2.f4 This does not work in Postgres. How to convert this statement to Postgres 8.1 ? Andrus. ---(end of broadc