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
what is the functionality of the function htmlentities? : Sql dba
what is unique key constraint? : Sql dba
Hi how to import oracle sequence in Informatica? Please write stored procedure code that will import oracle sequence in Informatica SP transformation as per below scenario Oracle table product list Pro_id, pro_name 101, LED Lights. 102, 20watt CFL Lights. 103, 30 watt CFL lights Now a new flat file with new product list needs to be added to oracle table product list with oracle sequence. flat file product Prono,pro_name, 1, 20 watt tube light 2, 30 watt tube light & target should be like 101, LED Lights. 102, 20watt CFL Lights. 103, 30 watt CFL lights. 104, 20 watt tube light 105, 30 watt tube light thks reg suvarna joshi suvarnaatsuvarna@rediffmail.com
how to decrement dates by 1 in mysql? : Sql dba
How can you select unique records from a table?
What are the types of dbms?
What is replication id?
Why is sql better than hql?
What is bulk collect in pl sql?
What is difference between db2 and sql?
What is sqlservr exe?
how can I make a script that can be bi-language (supports english, german)? : Sql dba
What is an emotional trigger?
What is pl sql block in dbms?
What is pl sql package?