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...

Hello all,
I have data like :-

year amt
2004 10
2005 20
2006 30

Now i want output as:-

2004 2005 2006
10 30 60

but i have to use here group by on year.So, i need a single
query within that i can find.

Answer Posted / murali krishna reddy

SELECT A.YEAR, (SELECT SUM(AMT) FROM ACCOUNT WHERE YEAR <=
A.YEAR) AS AMT
FROM ACCOUNT AS A GROUP BY A.YEAR

How about this?

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is pessimistic concurrency?

976


How to enable tcp/ip protocol on a sql server?

1162


What is log cache in sql server?

1046


How to write a query with a right outer join in ms sql server?

914


What are the new data types are introduced in sql 2000?

907


What is NOT NULL Constraint in sql server 2012?

1001


What is a constant or literal in ms sql server?

1048


what are the basic functions for master, msdb, model, tempdb and resource system databases? : sql server database administration

992


How to recover from sql injection? : sql server security

1019


Can I run multiple instances of sql server 2000 at the same time on one computer?

1074


Which table keeps information about stored procedures?

939


How use inner join in sql server?

1134


can any body tell me how to know the password of current user in sql server

2073


What is log in sql server?

1149


How to list all login names on the ms sql server?

1143