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
Can instead of triggers be used to fire once for each statement on a view?
What is the difference between a primary key and a clustered index?
what is the difference between mysql_fetch_array and mysql_fetch_object? : Sql dba
How can you save or place your msg in a table?
How is data stored in sql?
What are different types of functions in sql?
Is it possible to remove child records without removing master table records...the two having pk,fk relationship?
What is difference between cursor and trigger?
how to check server status with 'mysqladmin'? : Sql dba
What will you get by the cursor attribute sql%rowcount?
Explain sql data types?
How to look at the current sql*plus system settings?
Can we connect to postgresql using sql developer?
Can there be more than one function with a similar name in a pl/sql block?
Where is all the data on the internet stored?