Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Update with condition

Re: Update with condition

From: unstoppable1001 <style1001_at_yahoo.com>
Date: Tue, 28 Aug 2001 15:24:55 -0700
Message-ID: <9mh57c$ldj$1@news.ilink.net>


What is the relationship between the two tables?

Also, many values in T2.F3 could be greater than T1.F3. Do you want the first one? last one?
I would start with this template and then, after you see what I'm doing, change it to what you need.

update T1

   set F1 = (select min(T2.F1) from T2 where T1.F3 > T2.F3);

This will update T1 and set T1.F1 to the first T2.F1 value where T1.F3 is greater than T2.F3. It sounds confusing, but I don't have the specifics ... so ...

"gil guerillot" <gil.guerillot_at_ratp.fr> wrote in message news:3B8BAEBB.5E866007_at_ratp.fr...
> I have 2 tables with 3 fields
>
> T1
>
> F1
> F2
> F3
>
>
> T2
>
> F1
> F2
> F3
>
> the common key is F1
> i want to update T1.F1 with the value of T2.F1
>
> but only when T1.F3 > T2.F3
>
> how can i do simply (SQL) wihtout PL/SQL ?
>
> thanks
>
Received on Tue Aug 28 2001 - 17:24:55 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US