sql - Pivot table using dates -


I have a view that includes the following fields ...

  Conid int Task varchar MeasureCategory varchar state four (2) DueDate datetime, frequency four (1) pattern four (1) TargetMin decimal TargetMax decimal decimal Decimal   

Use variable for ConID, State, and DueDate To do this, I want to create a pivot table which gives me the average value to target, target Max, and achieve, for months, months of variables For the due date, each of the last four months from that variable, with the expiration date variables value of 9/30, 2014, I want to assume that from time to time the value for the due date ...

  9/1/2014 - 9/30/2014 8/1/2014 / - 8/31/2014 7/1/2014 - 7/31/2014 6/1/2014 - 6/30/2014   

It should also be for registered variables for Conid and for state.

All three variables, condoms, states, and due dates will change. Therefore, for a given condom in a given state, I want to get the average value for GoalMine, Target Max and from the last four months, which ends with variables recorded for the due date. There may be several entries within each month, or data can be entered on the basis of the week or month as an entry. That's why I want to average on average.

I am new to the pivot table and I do not know where it starts from.

What do I need to see ...

  -_____---------------------- --------------- Month 1 VALUES___________________ = Month 2 VALUES________________ - MONTH 3 VALUES___________________ - MONTH 4 VALUES____________________ Work - MeasureCategory - Frequency - Pattern - TargetMin - TargetMax - Gain - TargetMin - TargetMax - Acquired Instead of - TargetMin - TargetMax - achieved - TargetMin - TargetMax - achieved    

Will work for you, I want to give you a link (technet.microsoft.com) which has some examples on basic usage. Also, if you search around on the internet you will find lots of examples about using the pivot on StackOverflow.

The need for the axis to be dynamic, from StackOverflow.com

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -