title: Sybase SQL update with self-join
body: <p>What's the right syntax in Sybase SQL to do an update with a self join? E.g. assuming you have the below table (#tmptbl):</p>
  
  <pre><code>account | client  |amount | date
  -------------------------------------
  ACT1    | CLIENTA | 12    |2010-12-30
  ACT2    | CLIENTB | 5     |2010-12-30
  ACT1    | CLIENTA | 17    |2010-12-31
  ACT2    | CLIENTB | 6     |2010-12-31
  </code></pre>
  
  <p>I want to overwrite the amounts on 2010-12-31 with the amount values from 2010-12-30.</p>
  
  <p>I feel like writing something like this:</p>
  
  <pre><code>update old
  set old.amount = new.amount
  from #tmptbl old,  #tmptbl new
  where 
  /*filter old*/
  old.account = 'ACT1' 
  and old.date = '2010-12-30' 
  and old.client = 'CLIENTA' 
  /* self-join new and old*/
  and old.account = new.account 
  and old.client = new.client 
  /* filter new */
  and new.date = '2010-12-31' 
  </code></pre>
  
  <p>But it doesn't look like Sybase accepts an alias in the 'update &lt;>' clause. What's the proper way of doing this?</p>
  
  <p>Thanks!</p>