<p>Using SqlServer, and trying to update rows from within the same table. I want to use a table alias for readability.
This is the way I am doing it at the moment:</p>
<pre><code>UPDATE ra 
SET ra.ItemValue = rb.ItemValue
FROM dbo.Rates ra, dbo.Rates rb
WHERE ra.ResourceID = rb.ResourceID
AND ra.PriceSched = 't8'
AND rb.PriceSched = 't9'
</code></pre>
<p>Are there easier / better ways?</p>

[{'answer_id': 835999, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 5, 'selected': False, 'text': "<pre><code>UPDATE ra \n   SET ra.ItemValue = rb.ItemValue\n  FROM dbo.Rates ra\n INNER JOIN dbo.Rates rb\n         ON ra.ResourceID = rb.ResourceID\nWHERE ra.PriceSched = 't8'\n  AND rb.PriceSched = 't9';\n</code></pre>\n\n<p>This might help in improving performance.</p>\n"}, {'answer_id': 14413368, 'author': 'Subhas Malik', 'author_id': 1533745, 'author_profile': 'https://Stackoverflow.com/users/1533745', 'pm_score': 1, 'selected': False, 'text': "<p><strong>Table alias in Update Query in T-SQL( Microsoft SQL) .\nfor MS SQL Server 2008 R2 it's work just fine</strong></p>\n\n<pre><code>UPDATE A_GeneralLedger  set ScheduleId=g.ScheduleId\nfrom A_GeneralLedger l inner join A_AcGroup g on g.ACGroupID=l.AccountGroupID\n</code></pre>\n"}]
['https://Stackoverflow.com/questions/31551', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2027/']