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
What is pessimistic concurrency?
How to enable tcp/ip protocol on a sql server?
What is log cache in sql server?
How to write a query with a right outer join in ms sql server?
What are the new data types are introduced in sql 2000?
What is NOT NULL Constraint in sql server 2012?
What is a constant or literal in ms sql server?
what are the basic functions for master, msdb, model, tempdb and resource system databases? : sql server database administration
How to recover from sql injection? : sql server security
Can I run multiple instances of sql server 2000 at the same time on one computer?
Which table keeps information about stored procedures?
How use inner join in sql server?
can any body tell me how to know the password of current user in sql server
What is log in sql server?
How to list all login names on the ms sql server?