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 / ravi
select sum(sales) sales_count,sum(sales_amount) t_sales_amount
,(select sum(sales_count) sales_count(A),sum(sales_amount)
t_sales_amt(A) from sales_table group by prod) from sales_table;
| Is This Answer Correct ? | 0 Yes | 4 No |
Post New Answer View All Answers
Which one is better subquery or joins?
Can we create table inside stored procedure?
How many clustered indexes can you have?
What are the basic sql commands?
What are the benefits of stored procedures?
How do you write an inner join query?
what is the use of friend function? : Sql dba
What is meaning of <> in sql?
what is 'mysqlcheck'? : Sql dba
What is package in pl sql with an examples?
Why use stored procedures?
Can we commit inside a trigger?
What is sql dialect?
What is rank () in sql?
What is the clause we need to add in function body to return variable?