title: In SQL How do I copy values from one table to another based on another field's value?
body: <p>Okay I have two tables</p>
  
  <p>VOUCHERT with the following fields</p>
  
  <pre><code>ACTIVATIONCODE
  SERIALNUMBER
  VOUCHERDATADBID 
  UNAVAILABLEAT   
  UNAVAILABLEOPERATORDBID 
  AVAILABLEAT 
  AVAILABLEOPERATORDBID   
  ACTIVATIONCODENEW   
  EXT1    
  EXT2    
  EXT3    
  DENOMINATION -- I added this column into the table.
  </code></pre>
  
  <p>and the second table is VOUCHERDATAT with the following fields</p>
  
  <pre><code>VOUCHERDATADBID
  BATCHID
  VALUE
  CURRENCY
  VOUCHERGROUP
  EXPIRYDATE
  AGENT
  EXT1
  EXT2
  EXT3
  </code></pre>
  
  <p>What I want to do is copy the corresponding VALUE from VOUCHERDATAT and put it into DENOMINATION of VOUCHERT. The linking between the two is VOUCHERDATADBID. How do I go about it?</p>
  
  <p>It is not a 1:1 mapping. What I mean is there may be 1000 SERIALNUMBERS with a same VOUCHERDATADBID. And that VOUCHERDATADBID has only entry in VOUCHERDATAT, hence one value. Therefore, all serial numbers belonging to a certain VOUCHERDATADBID will have the same value.</p>
  
  <p>Will JOINS work? What type of JOIN should I use? Or is UPDATE table the way to go?</p>
  
  <p>Thanks for the help !!</p>