Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is an index in sql with example?

977


What is parameter substitution in sql?

1033


How do I enable sql encryption?

1035


When can we use the where clause and the having clause?

1021


Why is sharding used?

1004


What is the difference between join and natural join?

931


How much does sql cost?

1011


How do you change a value in sql?

1022


How many databases can sql express handle?

989


What is dml and ddl?

960


What is the use of double ampersand (&&) in sql queries? Give an example

1140


What is an index? What are the types of indexes? How many clustered indexes can be created on a table?

1075


Can we create table inside stored procedure?

958


how do you know the version of your mysql server? : Sql dba

1005


what is a record in a database ? : Sql dba

1067