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
Explain where clause?
What is BCNF? How is it better than 2NF & 3NF?
How do I find the default sql server instance?
Explain the benefits of user-defined functions?
How to resolve the orphan use problem? : sql server security
What according to you is the difference between mysql and sql server performance?
Explain datetimeoffset data type in sal server 2008?
Explain system rowset functions?
How many types of dimensions are there and what are they? : sql server analysis services, ssas
How connect excel to sql server?
What are click through reports?
what is raid and what are different types of raid configurations? : Sql server database administration
What is acid mean in sql server?
How to find a value in another dataset based on current dataset field (ssrs 2008 r2)?
What are the five major components of a dbms?