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
How do you remove duplicate records from a table?
What is before trigger?
Can a primary key be a foreign key?
What are the different sql languages?
What is bulk compiling in pl/sql.?
Why we use triggers in mysql?
Is it possible to include an insert statement on the same table to which the trigger is assigned?
What are triggers and its uses?
What is multiple partition?
Which kind of parameters cannot have a default value in pl sql?
how to check server status with 'mysqladmin'? : Sql dba
explain what is mysql? : Sql dba
What port does sql server use?
Is postgresql a nosql database?
What is rank dense_rank and partition in sql?