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

Explain where clause?

977


What is BCNF? How is it better than 2NF & 3NF?

998


How do I find the default sql server instance?

928


Explain the benefits of user-defined functions?

1040


How to resolve the orphan use problem? : sql server security

999


What according to you is the difference between mysql and sql server performance?

1063


Explain datetimeoffset data type in sal server 2008?

893


Explain system rowset functions?

974


How many types of dimensions are there and what are they? : sql server analysis services, ssas

1053


How connect excel to sql server?

972


What are click through reports?

142


what is raid and what are different types of raid configurations? : Sql server database administration

1019


What is acid mean in sql server?

1094


How to find a value in another dataset based on current dataset field (ssrs 2008 r2)?

169


What are the five major components of a dbms?

920