Source is Sales Table:
Sno Prod Sales Sales_Amount
1 A 10 2000
2 A 20 1000
3 C 10 3000
4 D 30 4000
5 A 20 1000

Target :
Sales_Count T_Sales_Amt Sales_Count(A) T_Sales_Amt(A)
90 11000 50 4000

In single query, pls tell me.

Answer Posted / ravi

select sum(sales) sales_count,sum(sales_amount) t_sales_amount
,(select sum(sales_count) sales_count(A),sum(sales_amount)
t_sales_amt(A) from sales_table group by prod) from sales_table;

Is This Answer Correct ?    0 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to add new employee details in an employee_details table with the following details

823


What is difference between pls_integer and integer?

711


Why do we need sharding?

730


What is sql scripting?

753


What is the primary key?

700






what is the difference between char and varchar data types? : Sql dba

741


In a distributed database system, can we execute two queries simultaneously?

750


What is faster join or subquery?

712


Can we want to pass a parameter payroll_id to this external pl/sql function, how do we do it?

781


Is mariadb nosql?

771


What are the possible values that can be stored in a boolean data field?

719


What is the use of <> sql?

738


What is the command used to fetch first 5 characters of the string?

1096


How to select all records from the table?

804


Is sql dba a good career? : SQL DBA

712