sql - Row over partition for totaling data by month -


I have some data that I need to do for each month and I'm having trouble finding out That is 12

example:

Data is as follows:

  Claim GrossMitt Claims 49764.00 2014- 08-21 00: 00: 00.000 1382.43 2014-08-27 00: 00: 00.000 602.77 2014-09-02 00: 00: 00.000 497.04 2014-09-02 00: 00: 00.000   

Desired Results:

  GrossMit claim date 51146.43 August 10 99. 88 September   

Actual desired result:

  July-August September 0 Sorry, I did not include it before!  

I'm sure that this is the most basic example of using line on partition, maybe it's a lack of programming. Background but this is a concept that I can not wrap my head around

This is what I have done so far, but I'm not sure how to go to the next Qin.

  with CTE ([GrossAmt], ClaimMonth) (Select Top 10000 Addition ([GrossAmt]) TotalClaimAmt, is the case when the month ([ClaimDate]) = 1 again January 'when Month ([ClaimDate]) = 2 then 'February' when month ([ClaimDate]) = 3 then 'March' when month ([ClaimDate]) = 4 then 'April when month ([ClaimDate]) = 5 again When 'May' month ([claim]] = 6 then 'June' where month ([claim]] = 7 then 'July' ou Where ([claim]] = 8 August 'August' Where month ([claim]] = September 9 'September' when the month ([ClaimDate]) = 10 then October 'when the month ([ClaimDate]) = 11 then' November 'When Month ([ClaimDate]) = 12 then' Decmber 'can be terminated as ClaimMonth [Database]. [Dbo] [Table]) By Group By [Claim]] * CTE   

What I have to do, this is the basic text that how the division works. I have tried to read articles read online but nobody understands, they can be advanced and I lose it immediately It also does not help that I do not learn very well by reading, give it to me Need to see in action, and understand how it works.

Still, thanks for the help you guys are awesome! Edit:

Actual desired result:

  July 5, September 51146.43 10 99.81   

Sorry, I included this before did not do!

You need to use PIVOT to get the desired code CTE ([GrossAmt], MonthVal) (Selection Top 10000 plus (with [

CTE is monthly aggregation and pivoting

  CTE in horizontal columns The results are used to convert rows to GrossAmt] as GrossAmt, DATEADD (MONTH, DateDiff (MONTH, 0, ClaimDate), 0) as MonthVal by [Table1] DATEADD by Group (MONTH, DateDiff (MONTH) , 0, ClaimDate), 0)) Select * from (select [GrossAmt], m ([January] DATENAME (MONTH, MonthVal) ClaimMonth CTE) As for T-axis (for GrossAmt) ClaimMonth, [Febrauary], [March], [April], [May], [June], [ July], [August], [September], [October], [November], [December]) Private    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -