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

SELECT
T1.SALES_COUNT, T1.T_SALES_AMT,
T2.SALES_COUNT_A, T2.T_SALES_AMT_A
FROM
(SELECT SUM(SALES) SALES_COUNT,
SUM(SALES_AMOUNT) T_SALES_AMT
FROM SALES)T1,
(SELECT SUM(SALES) SALES_COUNT_A,
SUM(SALES_AMOUNT) T_SALES_AMT_A
FROM SALES
WHERE PROD='A' GROUP BY PROD)T2

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I run sql profiler?

1075


what is table? : Sql dba

1068


What is the difference between local and global temporary table?

1048


What makes a good primary key?

1047


what are the drivers in mysql? : Sql dba

1025


what are date and time intervals? : Sql dba

1060


Explain the difference in execution of triggers and stored procedures?

1023


How do you declare a user-defined exception?

1029


What is difference between sql and excel?

1098


Is left join and outer join same?

1074


What is the difference between alter trigger and drop trigger statements?

1113


how is myisam table stored? : Sql dba

1059


Can %notfound return null after a fetch?

1062


Can we use rowid as primary key?

990


Explain autonomous transaction.

1161