Venkat Govind

Venkat Govind

  • 1.2k
  • 557
  • 67.1k

how to count ruining total for the year in between selected

Sep 9 2015 6:09 AM
 month             total          Ruining Toatl 
Jan 2015          708                         708
Feb  2015          2                         710
march  2015        3                       713
apl  2015             4                       717
may  2015             6                      723
jun  2015             0                        723
july  2015            0                       723
aug  2015             0                       723 
 
 
Hi Can Get Above result in sql server i am using this query 
 
 
select CONVERT(CHAR(4), wf.Createdate, 100) + CONVERT(CHAR(4), wf.Createdate, 120) AS MonthYear,
(select COUNT(CONVERT(CHAR(4), Createdate, 100) + CONVERT(CHAR(4),Createdate, 120)) from mstr_workforce where Createdate<=wf.Createdate) as RuninngTotal
from mstr_workforce as wf where DATEADD(D, 0, DATEDIFF(D, 0,wf.Createdate)) Between
'01/01/2015' and '06/15/2015' group by wf.Createdate
 
get result below result  
 
 
MonthYear RuninngTotal
Jan 2015 708
Jan 2015 710
Jan 2015 713
Jan 2015 717
Jan 2015 723
Jan 2015 726
Jan 2015 735
Jan 2015 740
Jan 2015 741
Jan 2015 753
Jan 2015 757
Jan 2015 766
Jan 2015 771
Jan 2015 774
Jan 2015 775
Jan 2015 790
Jan 2015 794
Jan 2015 802
Jan 2015 804
Feb 2015 807
Feb 2015 821
Feb 2015 826
Feb 2015 829
Feb 2015 830
Feb 2015 845
Feb 2015 855
Feb 2015 879
Feb 2015 889
Feb 2015 893
Feb 2015 945
Feb 2015 952
Feb 2015 989
Feb 2015 993
Feb 2015 994
Feb 2015 999
Feb 2015 1002
Feb 2015 1003
Feb 2015 1014
Feb 2015 1019
Feb 2015 1022
Feb 2015 1025
Feb 2015 1028
Mar 2015 1029
Mar 2015 1032
Mar 2015 1037
Mar 2015 1048
Mar 2015 1050
Mar 2015 1052
Mar 2015 1053
Mar 2015 1059
Mar 2015 1065
Mar 2015 1067
Mar 2015 1073
Mar 2015 1078
Mar 2015 1086
Mar 2015 1090
Mar 2015 1093
Mar 2015 1098
Mar 2015 1100
Mar 2015 1104
Mar 2015 1105
Mar 2015 1109
Mar 2015 1110
Mar 2015 1112
Mar 2015 1114
Apr 2015 1118
Apr 2015 1121
Apr 2015 1127
Apr 2015 1130
Apr 2015 1135
Apr 2015 1137
Apr 2015 1139
Apr 2015 1141
Apr 2015 1150
Apr 2015 1155
Apr 2015 1160
Apr 2015 1167
Apr 2015 1174
Apr 2015 1176
Apr 2015 1182
Apr 2015 1195
Apr 2015 1197
Apr 2015 1202
Apr 2015 1215
Apr 2015 1225
Apr 2015 1233
Apr 2015 1235
Apr 2015 1238
Apr 2015 1255
Apr 2015 1256
May 2015 1264
May 2015 1275
May 2015 1280
May 2015 1281
May 2015 1282
May 2015 1288
May 2015 1296
May 2015 1301
May 2015 1308
May 2015 1318
May 2015 1321
May 2015 1327
May 2015 1336
May 2015 1340
May 2015 1356
May 2015 1374
May 2015 1466
May 2015 1481
May 2015 1505
May 2015 1525
May 2015 1529
May 2015 1532
May 2015 1537
May 2015 1542
May 2015 1551
May 2015 1567
Jun 2015 1568
Jun 2015 1577
Jun 2015 1586
Jun 2015 1605
Jun 2015 1612
Jun 2015 1615
Jun 2015 1616
Jun 2015 1628
Jun 2015 1635
Jun 2015 1636
Jun 2015 1641
Jun 2015 1643
Jun 2015 1652
 
 

Answers (1)