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 2005 Forums
 Transact-SQL (2005)
 Need help on this query

Author  Topic 

bfunny21
Starting Member

4 Posts

Posted - 2010-09-15 : 16:33:57
hi

i have my input table as follows

ID----total_amt-----total_month--------start_date
1-----1200000--------6-------------- 9/4/2009
2---- 300000---------3 ---------------- 1/1/2006
3---- 300000---------10--------------- 9/6/2006
4
5 ...so on

and i want a way to get the output as

ID
-----sept'09----oct'09----nov'09-----dec'09-----total for 2009---jan'10-----feb10----Tot
1---200000---200000---200000--- 200000----- 800000------ 200000----200000--


----- jan'06----- feb'06----- mar'06----- Total for 2006
2-----100000---- 100000-----100000---- 300000

divide the amount as per the total number of months

I am desperately looking for some piece of code to get this type of out put .... kindly help me out of this.

X002548
Not Just a Number

15586 Posts

Posted - 2010-09-15 : 16:56:20
could ou be a little more descriptive...like how your sample data transforms into your result set?

I don't see it



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

bfunny21
Starting Member

4 Posts

Posted - 2010-09-15 : 17:08:09
quote:
Originally posted by X002548

could ou be a little more descriptive...like how your sample data transforms into your result set?

I don't see it



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam








hi Brett

Actually the input table is the only table which i have and from that table i have to transform the data as per my output table ....
as i see i have to divide the table as per the number of months starting from the starting month based on start date and the amt will be same for all months ...

am i making sense ???
Go to Top of Page
   

- Advertisement -