Hey.

There is a table Table (id, date1, date2). How to check if at least one day from the period from date1 to date2 is included in a given month (the year is also specified)?

    1 answer 1

    Implying that Date1 is less than Date2:

    Date1 lies in the interval <1 day of the next month, and Date2> = 1 of the specified month. Specificity will enroll from the used DBMS.

    Update

    Need to work with dates.
    January 2014:
    The first number of 2014/01/01 - transfer to date type.
    Add 1 month get 1 day of the next month.
    Further by the algorithm.

    • @msi, for example, date1 = 01.01.2013, date2 = 01.01.2015 we are interested in January 2014. here I rested, how to check correctly? because this period satisfies our conditions, but as a condition, we write it in where - namak7
    • one
      Need to work with dates. January 2014: the first of 2014/01/01 - transfer to the date type. Add 1 month get 1 day of the next month. Further by the algorithm. - msi