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

How many postgresql users are there, worldwide?

996


Differentiate pl/sql and sql?

1013


What is pivot in sql?

873


What jobs use sql?

928


What are the two virtual tables available at the time of database trigger execution?

1161


Why indexing is needed?

943


What does sql stand for?

947


What is difference between sql and oracle?

1051


what is acid property in database? : Sql dba

962


Explain foreign key in sql?

972


What is multiple partition?

921


What is dynamic sql in pl sql?

984


What is package in pl sql?

967


how can we know the number of days between two given dates using mysql? : Sql dba

993


What does rownum mean in sql?

953