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 / shailesh j
select sum(sales) as Sales_Count,sum(sales_amount) as
T_Sales_Amt,SUM(DECODE(PROD,'A',SALES,0)) as
Sales_Count_A,SUM(DECODE(PROD,'A',SALES_AMOUNT,0))
T_Sales_Amt_A from sales;
| Is This Answer Correct ? | 11 Yes | 0 No |
Post New Answer View All Answers
Is pl sql still used?
how to drop an existing index in mysql? : Sql dba
What is difference between table and view?
Name the operator which is used in the query for pattern matching?
How to convert comma separated string to array in pl/sql?
What is primary key and foreign key?
What is a scalar value in sql?
What information is needed to connect sql*plus an oracle server?
where are cookies actually stored on the hard disk? : Sql dba
Is big data nosql?
Define join and name different types of joins?
How can a function retun more than one value in oracle with proper example?
What is cross join sql?
How many types of privileges are available in sql?
what are the types of join and explain each? : Sql dba