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 SQL Server?

1271


How does clustered and non clustered index work?

978


What is 4nf in normalization form?

1061


Why use “pivot” in sql server?

1176


Explain indexes disadvantages?

1141


What is inline variable assignment?

1082


What is the difference between having clause and where clause in sql server?

1164


Please explain that what are the basic functions for master, msdb, model, tempdb and resource databases? : SQL Server Architecture

1021


You want to implement the one-to-one relationship while designing tables. How would you do it?

1013


What is field with example?

976


Would you store your query in a ssrs report or a database server? State the reason why?

157


what is bit datatype and what's the information that can be stored inside a bit column? : Sql server database administration

1045


What is parameterized reports in ssrs ?

161


What is the purpose of the tempdb database?

1044


How will you make an attribute not process? : sql server analysis services, ssas

1159