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
What is aggregate function in sql?
What is trigger with example?
How to get help at the sql prompt?
How to select the Nth maximum salary from Table Emp in Oracle SQL Plus ?
What is Materialized View? In What Scenario we Use Materialized View?
What is sql analyzer?
What are its different types of dbms?
What is the difference between truncate and drop statements?
Can triggers stop a dml statement from executing on a table?
what is the command used to fetch first 5 characters of the string? : Sql dba
What is row_number () in sql?
What is difference between db2 and sql?
how to get @@error and @@rowcount at the same time? : Sql dba
What is sql resultset?
What is full form of rtm?