Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 04 Apr 2008 @ 10:47:08 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: Duplicate Row Error during an Update
 
From:   Gaitonde, Amol A

You are trying to update one row with 2 values( May be different or same). the query is logically incorrect.

Example

     TABLE EMP
     NAME    TASK_SCORE   YEAR
     Jon       1.105      2000
     Peter     1.107      2000
     Jon       1.105      2001
     Peter     1.103      2001

     TABLE EMP
     NAME    SALARY
     Jon     100000
     Peter   100000

If you write a query like below you might get a duplicate row error

     Update B
     Set salary = slary* Tas_Scoe
     Where a.name = B.name

Because I have missed putting filter on year and the salary field is getting updated with two values



     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023