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 SQL Server?
How does clustered and non clustered index work?
What is 4nf in normalization form?
Why use “pivot” in sql server?
Explain indexes disadvantages?
What is inline variable assignment?
What is the difference between having clause and where clause in sql server?
Please explain that what are the basic functions for master, msdb, model, tempdb and resource databases? : SQL Server Architecture
You want to implement the one-to-one relationship while designing tables. How would you do it?
What is field with example?
Would you store your query in a ssrs report or a database server? State the reason why?
what is bit datatype and what's the information that can be stored inside a bit column? : Sql server database administration
What is parameterized reports in ssrs ?
What is the purpose of the tempdb database?
How will you make an attribute not process? : sql server analysis services, ssas