sql - TSQL How to update column from row in same table? -


Say I have this table schema.

ID ADNO Amount

I Obtain This Data

  ID ADNO Zodiac 1 1020 100.00 2 2040 50.00  

How do I write a TSQL update query to update the Exton 1020 Amount column with the amount? From 2040 ??

Malcolm

Use the nested selection:

updated tablanem set zodiac = (where the tablainem from ID number = 2), where AccNo = 1200

Obviously if your situation is different, then suit you, eg if AccNo unique , You can use it.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -