Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Bad Field Update
On 10 Aug 2003 07:30:03 -0700, nhojnacki_at_cox.net (MikeP) wrote:
>I intended to update certain rows in one table, instead I updated them
>all. What is the best way to recover the previous data in this one
>field, Or do I need to run a script that populates the field from
>another table. There is a table that does contain the correct data,
>but it is a one to many relationship ( the bad data has one value but
>the other has mulitple values for the same record ) and I'm not sure
>how this can be handled.
>
>regards
>
>-Mike
You could retrieve the correct data using distinct
update bla
set field = (select distinct other_field from other bla where <foreign
key column in otherbla> = <primary key column in bla)
Sybrand Bakker, Senior Oracle DBA
To reply remove -verwijderdit from my e-mail address Received on Sun Aug 10 2003 - 09:59:22 CDT