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 / krishna

SQL> desc a;
Name Null? Type
------------------------------- -------- ----
A VARCHAR2(2)
B NUMBER(3)

SQL> select * from a;

A B
-- ---------
N 500
N 800
N 600
W 899
W 458
W 900

6 rows selected.

SQL> desc b;
Name Null? Type
------------------------------- -------- ----
A VARCHAR2(2)
B NUMBER(3)

SQL> select * from b;

no rows selected

SQL> insert into b (select a, max(b) from a group by a);

2 rows created.

SQL> select * from b;

A B
-- ---------
N 800
W 900

SQL>

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a rank in sql?

714


What is %type in pl sql?

712


How many subqueries can be nested in a statement?

693


What is pragma in sql?

819


what is online transaction processing (oltp)? : Sql dba

713






Can a table have no primary key?

775


What is sql key?

691


Is json a nosql?

723


Does google use sql?

706


how to drop an existing index in mysql? : Sql dba

714


What trigger means?

730


What is a trigger in sql?

887


What is difference between rank () row_number () and dense_rank () in sql?

805


What is the largest value that can be stored in a byte data field?

710


How many types of triggers are there in pl sql?

781