Looping over query by month
etings,
I have a query I am pulling that has a date field entitled, "Completed". I am attempting to loop over the query by date to slice and dice the data for a table and chart. Here is what I have done thus far...
Setup two variables where I am only interested in the month. My plan is to fileter the date by month so I can pull the data out by month.
<cfset startDate = #DatePart('m','01/01/09')#>
<cfset endDate = #DatePart('m',Now())#>
Here is my loop...
<cfloop from = "#startDate#" to = "#endDate#" index = "i" step = "1">
Here is one of my QoQs within the loop...
<cfquery name="NPS0" dbtype="query">
SELECT *
FROM rsNPS
WHERE #DatePart('m',rsNPS.completed)# = #i#
</cfquery>
I am having difficulties in getting this to work. Has anyone ever done something like this. I feel like the answer is right in front of me, but I have been staring at this code for a while. If anyone has any thoughts, I would be glad to hear them.
~Clay
