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

Home -> Community -> Usenet -> c.d.o.server -> Re: update

Re: update

From: Martin Haltmayer <Martin.Haltmayer_at_d2mail.de>
Date: Thu, 20 Dec 2001 16:03:46 +0100
Message-ID: <3C21FDD2.E0662173@d2mail.de>


Try

update --+ bypass_ujvc
(

select	c.code
	, c.value
	, m.max_value
from	cv c
	, (
	select	m.code
		, max (m.value) as max_value
	from	cv m
	group by m.code
	) m
where	1 = 1
and	c.code = m.code
) x
set	x.value = x.max_value

/

Regards,

Martin

Francesco Zavatarelli wrote:
>
> I have this table:
>
> code value
> 1 1000
> 1 2000
> 1 3000
> 2 1000
> 2 5000
> ... ...
>
> I want to set value to max(value) inside a GROUP
> i.e I want to get this:
>
> code value
> 1 3000 (changed from 1000 to 3000)
> 1 3000 (changed from 2000 to 3000)
> 1 3000
> 2 5000 (changed from 1000 to 5000)
> 2 5000
> ... ...
>
> which is the UPDATE statemet I have to use?
> thanks
> FZ
Received on Thu Dec 20 2001 - 09:03:46 CST

Original text of this message

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