I have a table with several columns that get populated via an UPDATE statement. The columns all contain numeric values which are calculated from expressions which sometime use many column sources in the calculations to arrive at the answer.
The examples below use overly simplified calculations so please keep in mind when answering this question that the actual calculations are much more complex.
Here are the two possible methods I can see using for these column updates.
One method - use seperate update statements:
SET Column1 = a*b
SET Column2 = Column1*c
Alternate method - use one update statement with expression for Column2 containing Column1's calculation and additional terms needed to get Column2's answer:
Column1 = a*b,
Column2 = a*b*c
Is one method more efficient than the other? If so, why?
View Complete Post