querying for “workweek” in Access SQL

前端 未结 1 892
半阙折子戏
半阙折子戏 2021-01-21 14:17

I have a formula from MS Excel 2007 which returns the workweek of a certain date within a certain month.

B1 = IF(AND(WEEKDAY(A2,1)<>1,A2=DATE(YEAR(A2),MONT         


        
1条回答
  •  情歌与酒
    2021-01-21 15:13

    Don't calculate, query. See:

    Why should I consider using an auxiliary calendar table?

    A calendar table can make it much easier to develop solutions around any business model which involves dates. Last I checked, this encompasses pretty much any business model you can think of, to some degree. Constant problems that end up requiring verbose, complicated and inefficient methods include the following questions:

    • How many business days between x and y?
    • What are all of the dates between the second Tuesday of March and the first Friday in April? 
    • On what date should I expect this shipment to arrive? 
    • What were the dates of all the Fridays in this quarter? 
    • ...  

    0 讨论(0)
提交回复
热议问题