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

How can you find out how many rows returned in a cursor?

969


What is the difference between locking and multi-versioning?

938


Explain triggers?

941


What are the different types of triggers in SQL SERVER?

1047


what is an extended stored procedure? Can you instantiate a com object by using t-sql? : Sql server database administration

967


What are different types of statements that are supported by sql?

980


Do you know how to make remote connection in database?

901


Explain what is the function of sql server agent windows service?

941


What is the server name for sql management studio?

947


What is a virtual table in sql?

942


How to create new tables with "create table" statements in ms sql server?

997


How to get the definition of a user defined function back?

999


What are subqueries in sql server?

1062


Explain raiserror in sql server?

961


How we can compare two database data?

873