SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Pivot table is ms sql express and i am not a good
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

bfeucht
Starting Member

USA
1 Posts

Posted - 08/15/2012 :  16:29:41  Show Profile  Reply with Quote
I am trying to write a sql statement in MS SQL Express that turns a flat table into a pivot table.

Sample data:


project id Date Amount
1 10/1/2012 10
1 11/1/2012 10
1 12/1/2012 10
1 1/1/2013 10
1 1/2/2013 10
1 1/3/2013 10
1 1/4/2013 10
1 1/5/2013 10
1 1/6/2013 10
1 1/7/2013 10
1 1/8/2013 10


And Returns this;

Project id 10/1/2012 11/1/2012 12/1/2012 1/1/2013 2/1/2013 3/1/2013
1 10
1 10
1 10
1 10
1 10
1 10


The Dates are dynmanic


sdsdsd

visakh16
Very Important crosS Applying yaK Herder

India
47087 Posts

Posted - 08/15/2012 :  22:29:54  Show Profile  Reply with Quote
see

http://dotnetgalactics.wordpress.com/2009/10/23/using-sql-server-20052008-pivot-on-unknown-number-of-columns-dynamic-pivot/

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22460 Posts

Posted - 08/16/2012 :  07:36:12  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Also refer
http://beyondrelational.com/modules/2/blogs/70/posts/10840/dynamic-pivot-in-sql-server-2005.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000