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 is an index in sql with example?
What is parameter substitution in sql?
How do I enable sql encryption?
When can we use the where clause and the having clause?
Why is sharding used?
What is the difference between join and natural join?
How much does sql cost?
How do you change a value in sql?
How many databases can sql express handle?
What is dml and ddl?
What is the use of double ampersand (&&) in sql queries? Give an example
What is an index? What are the types of indexes? How many clustered indexes can be created on a table?
Can we create table inside stored procedure?
how do you know the version of your mysql server? : Sql dba
what is a record in a database ? : Sql dba