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 / vishalakshi
select
tab1.sales_count,tab1.t_sales_amt ,tab2.sales_count_A,tab2.t
_sales_amt_A
From
(select sum(sales) sales_count,sum(sales_amount)
t_sales_amt from sales)tab1,
(select sum(sales) sales_count_A,sum(sales_amount)
t_sales_amt_A from sales where prod='A' group by prod)tab2
| Is This Answer Correct ? | 8 Yes | 1 No |
Post New Answer View All Answers
What are pl/sql cursors?
Is nosql faster than sql?
Can cursors be part of a trigger body?
How do you create a unique index?
What is trigger in pl sql with examples?
how to enter binary numbers in sql statements? : Sql dba
What is natural join in sql?
what is schema? : Sql dba
what is the difference between myisam static and myisam dynamic? : Sql dba
How to test for null values?
What is trigger in sql? Explain
What is error ora-01000: maximum open cursors exceeded
how to use regular expression in pattern match conditions? : Sql dba
What is a recursive stored procedure?
how tsql statements can be written and submitted to the database engine? : Transact sql