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 tables and fields? : Sql dba
What is normalization in sql?
Why do we use joins in sql?
How to run sql commands in sql*plus?
What is the need of a partition key?
What are the most important ddl statements in sql?
Which one is better subquery or joins?
How do I run a script in sql developer?
What is java sql connection?
Write a sql query to convert all character to uppercase after hypen.
What is the difference between inner join and natural join?
How many types of literals are available in pl sql?
What is on delete set null?
What is a variable in sql?
Which is better cte or subquery?