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: sql to update where all related records meet criteria

Re: sql to update where all related records meet criteria

From: Chris L. <diversos_at_uol.com.ar>
Date: 31 Oct 2005 16:17:08 -0800
Message-ID: <1130804228.487420.233340@o13g2000cwo.googlegroups.com>

Try updating version.stage_fk to max(section.stage_fk) where version_pk equals version_fk
and max(stage_fk) equals min(stage_fk).

That should get you started. Beware of null values!

C.

YoMama wrote:
> I need help writing a sql statement. The table structures are as
> follows:
> version table = version_pk, stage_fk
> section table = section_pk, version_fk, stage_fk
>
> There is a one-to-many relationship from version to section.
>
> The query needs to update version.stage_fk=61 where ALL of a
> version's related section.stage_fks=61 (if any one section for a
> given version has a stage_fk other than 61, the version should NOT
> change.
Received on Mon Oct 31 2005 - 18:17:08 CST

Original text of this message

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