Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Mibble
Starting Member
2 Posts |
Posted - 2006-11-14 : 13:53:43
|
| Hello,I am very new to SQL, and am learning how to update tables.I have one table which has for fields:PKInventoryID, PartNumber, ProductName, QuantityOnHand, UnitPrice.What I am wanting to do, is update two PKInventoryID items, changing the QuantityOnHand by the amount ordered.ie; PKInventoryId # 26 has QuantityOnHand of 23 and 3 items were ordered.PKInventoryID # 13 has QuantityOnHand of 28 and 10 were ordered.What is the proper syntax for selecting and updating the records?Thanks! |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-11-14 : 13:56:39
|
| UPDATE OneTableSET QuantityOnHand = QuantityOnHand - 3WHERE PKInventoryId = 26UPDATE OneTableSET QuantityOnHand = QuantityOnHand - 10WHERE PKInventoryId = 13Peter LarssonHelsingborg, Sweden |
 |
|
|
Mibble
Starting Member
2 Posts |
Posted - 2006-11-15 : 14:58:26
|
| thanks, that worked! |
 |
|
|
|
|
|