portal entry

select a category, or use search below
(searches all categories and all time range)
Title:

Query by week

| View in Portal
June 05, 2019 12:57:05 AM GMT
2 Comments
<p>I am converting old Access DB's to SQL and writing a CF app.  I want to print a report that for shipments per week.  How can I query a table with a ship date of 06/04/2019 and return everything that needs to be shipped in that week?  The daily WHERE statement is WHERE shipdate = '#DateFormat(Now(), "mm/dd/yyyy")#'</p>
<p>The post <a rel="nofollow" href="https://coldfusion.adobe.com/2019/06/query-by-week/">Query by week</a> appeared first on <a rel="nofollow" href="https://coldfusion.adobe.com">ColdFusion</a>.</p>
Labels: CF2018 Updates, ColdFusion 2018, Question, cf2018 updates, ColdFusion, coldfusion 2018, question

Comments:

You don't say what your database is, but something like <blockquote>WHERE shipdate < <cfqueryparam value="#dateAdd(-1,'w',now())#" cfsqltype="datestamp"/> AND  shipdate > <cfqueryparam value="#dateAdd(-2,'w',now())#" cfsqltype="datestamp"/></blockquote>
Comment by Tom Chiverton
2099 | June 07, 2019 01:23:29 PM GMT
How about     WHERE CONVERT(date, shipdate) BETWEEN DATEADD(ww, -2, getDate()) AND DATEADD(ww, -1, getDate())
Comment by James Mohler
2103 | June 07, 2019 11:15:30 PM GMT