How Can I Create a WHERE Statement that Always Cuts the Data Off at Last Week
Posted on 2010-01-08
I have a Query that is an Outer Join of a table of possible week ending dates (Saturdays) and tables of production data grouped by week ending dates (Saturdays)
I use this approach to accomodate possible "down" weeks. Rather than skip the week, it will return a null for that week, but since all plants are included, something is always returned (Never are all plants down at once)
the problem is this potential table goes out in the future several years. For intenral reasons, the current WHERE only pulls data with a weekendingdate greater than 4/12/2008.
I would like it to cut off the data at the previous week, (Most recent past Saturday) but I don't know how to construct that.
Has anyone ever done this, and can you show me how? Thanks.
All the dates have already been converted to Saturday week ending dates, so the WHERE only has to limit the data be the most recent past Saturday at any time the query is run.