Question: We are preparing to archive old data from the Sales Orders Modify database. Before we do this, we would like to update the OrderTotal column
We are preparing to archive old data from the Sales Orders Modify database. Before we do this, we would like to update the OrderTotal column for each order to be sure that it reflects the total of the line items in that order. First, write a SELECT query showing what the OrderTotal should be for each order. Include three columns: the order number, the current order total and the calculated order total (as NewOrderTotal). Use a subquery as the third column to calculate the total of the line items for that order.
Step by Step Solution
There are 3 Steps involved in it
Lets assume table name as SalesOrders columns like OrderNumber ... View full answer
Get step-by-step solutions from verified subject matter experts
