This is a discussion on Advise on Multiple Column Updates within the SQL Server forums, part of the Microsoft SQL Server category; --> Using SQL2000, is there another way of optimizing the original query below. TIA, Bob Update Transaction set field1 = ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Using SQL2000, is there another way of optimizing the original query below. TIA, Bob Update Transaction set field1 = (select (sum(tax)-sum(credit))/sum(credit) from tblOrder where tblOrder.id = Transaction.id), field2 = (select avg(price) from tblOrder where tblOrder.id = Transaction.id), field3 = (select min(cost) from tblOrder where tblOrder.id = Transaction.id) etc.. (there are six additional updates) Is this a quicker way: Update Transaction SET field1 = (sum(tax)-sum(credit))/sum(credit) , field2 = avg(price) , field3 = min(cost) , etc..... FROM tblOrder WHERE tblOrder.id = Transaction.id |