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

How do you remove duplicate records from a table?

887


What is before trigger?

948


Can a primary key be a foreign key?

973


What are the different sql languages?

988


What is bulk compiling in pl/sql.?

1068


Why we use triggers in mysql?

938


Is it possible to include an insert statement on the same table to which the trigger is assigned?

961


What are triggers and its uses?

1004


What is multiple partition?

921


Which kind of parameters cannot have a default value in pl sql?

1074


how to check server status with 'mysqladmin'? : Sql dba

1018


explain what is mysql? : Sql dba

1034


What port does sql server use?

992


Is postgresql a nosql database?

1079


What is rank dense_rank and partition in sql?

978