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 / satish
select sum(prod),
sum(sales_amount),
sum(decode(prod,'A',sales)),
sum(decode(prod,'A',sales_amount))
from sales
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
How are sql commands classified?
what is a table in a database ? : Sql dba
Is null operator in sql?
What are the disadvantages of not performing database normalization?
Is trigger a stored procedure?
what is a relationship and what are they? : Sql dba
What is clause in sql?
what is the use of friend function? : Sql dba
How to select the Nth maximum salary from Table Emp in Oracle SQL Plus ?
When to use inner join and left join?
what are the differences between require and include, include_once and require_once? : Sql dba
Explain how exception handling is done in advance pl/sql?
What is sql injection owasp?
Explain normalization and what are the advantages of it?
Is it possible to update views?