title: Update Table with a "Select query" with a where clause
body: <p>I want to achieve the following: </p>
  
  <p><strong>Current State of table (my_table)</strong>                                 </p>
  
  <pre><code> id        totalX          totalY          totalZ               
   --------- --------------  --------------  --------------       
           9             34              334             0      
          10              6               56             0      
          11             21              251             0      
          12              3               93             0   
  </code></pre>
  
  <p><strong>Query result of (my_table2)</strong></p>
  
  <pre><code>select id,count(*) as total FROM my_table2 WHERE column_2 = 1 GROUP BY id
  
   id        total               
   --------- --------------       
           9            500      
          10            600      
          11            700      
          12            800  
  </code></pre>
  
  <p><strong>Expected State of table (my_table)</strong></p>
  
  <pre><code> id        totalX          totalY          totalZ               
   --------- --------------  --------------  --------------       
           9             34              334             500      
          10              6               56             600      
          11             21              251             700      
          12              3               93             800    
  </code></pre>
  
  <p>Can this be done in ONE update query ? I am looking for Sybase ASE 12.5 on a RHEL 5.0</p>
  
  <p><strong>EDIT:</strong> I coudn't find the solution for Sybase, but the current answer to the question works on MS SQL Server.. </p>