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
Is there a way to automate sql execution from the command-line, batch job or shell script?
What does fetching a cursor do?
What is the difference between microsoft access and sql server?
Does pdo prevent sql injection?
what are the different tables present in mysql? : Sql dba
How to add a column ‘salary’ to a table employee_details?
How do I install microsoft sql?
What is a sql trace file?
what is self join and what is the requirement of self join? : Sql dba
Which data dictionary views have the information on the triggers that are available in the database?
What is sqlservr exe?
Which sql statement is used to return only different values?
Can we insert data in view?
How do you update a value in sql?
What are the features of pl sql?