Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 i want o/p like this

Author  Topic 

praveen050
Starting Member

9 Posts

Posted - 2012-06-04 : 02:13:56
this is my table

YEAR MONTH_NUMBER AC_USD
2007 12 2,223,757,572.3
2008 1 337,168,751.28
2008 2 320,847,865.22
2008 3 313,340,930.72
2008 4 317,816,048.3
2008 5 312,048,722.24

i want o/p like this
YEAR MONTH_NUMBER CY Revenue PY Revenue Variance
2007 12 2,223,757,572.3 0 2,223,757,572.3
2008 1 337,168,751.28 0 337,168,751.3
2008 2 320,847,865.22 0 320,847,865.2
2008 3 313,340,930.72 0 313,340,930.7
2008 4 317,816,048.3 0 317,816,048.3
2008 5 312,048,722.24 0 312,048,722.2
2008 6 322,824,314.9 0 322,824,314.9
2008 7 326,693,981.879999 0 326,693,981.9
2008 8 301,424,277.62 0 301,424,277.6
2008 9 334,869,665.94 0 334,869,665.9
2008 10 329,890,993.64 0 329,890,993.6
2008 11 277,395,124.58 0 277,395,124.6
2008 12 322,481,081.72 2,223,757,572.3 -1,901,276,490.6
2009 1 350,519,005.02 337,168,751.28 13,350,253.7
2009 2 329,270,395.94 320,847,865.22 8,422,530.7

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2012-06-04 : 06:27:56
You asked this on 5/28 here http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=175195

AND you got an answer.









How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -