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 / shailesh j

select sum(sales) as Sales_Count,sum(sales_amount) as
T_Sales_Amt,SUM(DECODE(PROD,'A',SALES,0)) as
Sales_Count_A,SUM(DECODE(PROD,'A',SALES_AMOUNT,0))
T_Sales_Amt_A from sales;

Is This Answer Correct ?    11 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is normalization sql?

1056


what is the difference between a local and a global temporary table? : Sql dba

1073


What is data control language?

990


How many triggers can be applied to a table?

1063


Can you rollback after commit?

985


Define concurrency control. : Transact sql

1191


What is write ahead logging in sql server?

1050


Can we rollback after truncate?

1031


Why do we need cursors in pl sql?

1081


What is scalar function?

1051


What is a primary key example?

957


Is drop table faster than truncate?

990


What is data modelling in sql?

1017


What is a Mapplet?

1120


What is compiled query?

1035