help me in understanding this update statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aakcse
    New Member
    • Sep 2008
    • 1

    help me in understanding this update statement

    Help needed in understanding the below update statement


    Code:
    update results_key set 
    
    result = temp.tally
    
    from(
    
            select testid,result,count(*) as tally
    
            from reslults_emp
    
            where testid='e001'
    
         ) temp
    
    where resluts_key.testid=temp.testid
    
    and results_key.value=temp.result



    According to me result expect one and only one value from temp.tally

    but it is returning 2 values and the update is working perfectly

    updating 2 records.



    why I am confused is because I have back ground of Oracle sql plsql and in Oracle

    update this is not possible it will give error stating too many rows.



    can any body explain me this update statement



    Thanks

    aak.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    you need to deeply look into the join part for your answer.

    Comment

    Working...