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 / satish

select sum(prod),
sum(sales_amount),
sum(decode(prod,'A',sales)),
sum(decode(prod,'A',sales_amount))
from sales

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can instead of triggers be used to fire once for each statement on a view?

897


What is the difference between a primary key and a clustered index?

934


what is the difference between mysql_fetch_array and mysql_fetch_object? : Sql dba

1006


How can you save or place your msg in a table?

954


How is data stored in sql?

1005


What are different types of functions in sql?

959


Is it possible to remove child records without removing master table records...the two having pk,fk relationship?

1219


What is difference between cursor and trigger?

1021


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

1018


What will you get by the cursor attribute sql%rowcount?

974


Explain sql data types?

1037


How to look at the current sql*plus system settings?

1083


Can we connect to postgresql using sql developer?

938


Can there be more than one function with a similar name in a pl/sql block?

927


Where is all the data on the internet stored?

949