Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    5

    Unanswered: how to select 1st monday of the month

    hi there! does anyone know how to select a particular date? I have a column that contains dates, and would like to select only those that fall on the first monday of a particular month.
    Thanks!

  2. #2
    Join Date
    Oct 2003
    Posts
    706
    I find that one of the most useful tables to have is a great big lookup-table, primary-keyed by date, with every date for about 200 years listed in it. ("Dig me up and I'll fix it then.") You can enter, for each date, every possible thing you could want to know about that date... including for example, "what's the date of 'the first of next month?'"

    The difficult date-calculations become something that's quite easy to describe and easy for the DBMS to handle... a simple join.

    I've used this trick with DBMSes of all descriptons; sometimes out of necessity (because they were dumb-as-toast about dates or because it took too long), but mainly because it's a simple and elegant way to get a lot of things done.
    ChimneySweep(R): fast, automatic
    table repair at a click of the
    mouse! http://www.sundialservices.com

  3. #3
    Join Date
    Mar 2004
    Posts
    5
    thanks! but wouldn't it be easier to create a function rather than a table containing dates for 200 years? What i need to do exactly is to be able to select entries from tables by week of month, although the weeks should be made so that the first week of the month is that which contains the first monday of the month.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •