Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/10/2022 in all areas

  1. You are making life hard for yourself holding working days by month and working with weeks that not align to those months. If I were you I'd create a table of holiday dates eg +------------------+-----------------------+ | Date | Holiday | +------------------+-----------------------+ | 2012-01-01 | New Year | | 2012-04-06 | Good Friday | | 2012-04-09 | Easter Monday | | 2012-05-07 | Mayday Holiday | | 2012-05-08 | Jubilee Holiday | | 2012-08-27 | Late Summer Holiday | | 2012-12-25 | Christmas Day | | 2012-12-26 | Boxing Day | +------------------+-----------------------+ Then SELECT w.from_week, w.to_week, (w.to_week - w.from_week + 1) * 5 - (SELECT COUNT(*) FROM holiday WHERE WEEK(hol_date) BETWEEN w.from_week AND w.to_week) as workdays FROM so_week w; Which gives this with my dates +-----------+---------+----------+ | from_week | to_week | workdays | +-----------+---------+----------+ | 17 | 20 | 18 | | 33 | 36 | 19 | +-----------+---------+----------+
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.