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
How can we call UDF(User Define Function) using C# code in ASP.net ?
Explain what stored procedure sp_replcounters is used for? : sql server replication
as a part of your job, what are the dbcc commands that you commonly use for database maintenance? : Sql server database administration
Give me any three differences between Truncate and Delete.
Are connections to sql server encrypted?
which backup strategy you are following at ur company
Can group by be used without aggregate functions?
What is Federation and Federation Member?
what is the primary use of the model database? : Sql server administration
what information is maintained within the msdb database? : Sql server administration
How can i Relate Tables in SSIS
Explain the third normal form(3nf)?
What is the difference in accessing db between sql server vs sql azure?
What is named calculation? : sql server analysis services, ssas
Types of Authentications in Sql Server? How user gets authenticated through windows authentication?