我想在本月的每個第一個月份顯示下面的代碼。 因此,對於四月,它將擁有自己的'display_count_pending_outer' ,一旦5月1日到達,它將顯示一個新的'display_count_pending_outer'。 在圖像中,我想在每個月的第一天顯示它。如何顯示特定日期的輸出?
<cfquery datasource ="Intranet" name="GetDeptSubmissions">SELECT * FROM CSEReduxResponses</cfquery>
<cfquery dbtype="query" name="GetPending">SELECT * FROM GetDeptSubmissions WHERE status = 1 AND execoffice_status = 0</cfquery>
<cfquery dbtype="query" name="GetApproved">SELECT * FROM GetDeptSubmissions WHERE status = 1 AND execoffice_status = 1</cfquery>
<cfquery dbtype="query" name="GetDenied">SELECT * FROM GetDeptSubmissions WHERE status = 1 AND execoffice_status = 2</cfquery>
<cfoutput>
<div>
<div class="display_count pending_outer">
<div class="display_count_desc pending_inner">Pending</div>
<cfif GetPending.RecordCount gt 0><a href="cse_execoffice_pending.cfm"></cfif>
<span class="display_count_number">#GetPending.RecordCount#</span>
<cfif GetPending.RecordCount gt 0></a></cfif>
</div><!--- /div class="display_count" --->
<div class="display_count approved_outer">
<div class="display_count_desc approved_inner">Approved *</div>
<cfif GetApproved.RecordCount gt 0><a href="cse_execoffice.cfm?approved"></cfif>
<span class="display_count_number">#GetApproved.RecordCount#</span><br>
<cfif GetApproved.RecordCount gt 0></a></cfif>
</div><!--- /div class="display_count" --->
<div class="display_count denied_outer">
<div class="display_count_desc denied_inner">Denied</div>
<cfif GetDenied.RecordCount gt 0><a href="cse_execoffice.cfm?denied"></cfif>
<span class="display_count_number">#GetDenied.RecordCount#</span><br>
<cfif GetDenied.RecordCount gt 0></a></cfif>
</div><!--- /div class="display_count" --->
</div>
</cfoutput>
現在它這樣表示
當您運行發佈的代碼時會發生什麼? –
我不認爲你提供了足夠的信息來獲得一個很好的答案。我建議你看看TSQL函數'DatePart'。例如'SELECT DATEPART(day,GETDATE())'返回9(4月9日)。你的查詢可能看起來像'SELECT * FROM GetDeptSubmissions WHERE status = 1 AND execoffice_status = 0 AND DatePart(day,YourDateColumnHere)= 1' – InbetweenWeekends
現在它將所有月份的所有數據都存入一個div – user3408399