how to Update table Sales_summary with max(sales) data from
table sales_dataTable 1. sales_data table Table 2.
Sales_summary
Region sales Region sales
N 500 N 0
N 800 W 0
N 600
W 899
W 458
W 900
I want the Sales_summary After Update like this
Region Sales
N 800
W 900
Answer Posted / soma
Update Sales_summary set sales = s2.sales
From Sales_summary s1,
(
Select Region, max(sales) sales
From sales_data group by Region
)s2
where s1.Region = s2.Region;
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
How do you define a foreign key?
what is the difference between cluster and non cluster index? : Sql dba
What is mutating trigger?
What is date functions?
What is the left table in sql?
how do you tune the slow running queries in oracle db , explain the methodology
Is sqlite thread safe?
What is string join?
what happens if null values are involved in expressions? : Sql dba
What is set transaction?
What are the two types of periodical indexes?
What is pivot query?
What is the clause we need to add in function body to return variable?
What is the difference between distinct and unique in sql?
can a stored procedure call itself or recursive stored procedure? : Sql dba