This is a discussion on How do I find if date 'MMDD' is covered by timespan covered byTIME_START and TIME_END ? within the MySQL Database forums, part of the Database Forums category; I have a table, say, 'stories', with the following two fields: starts_at, 4 digits: "MMDD" - month and date ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I have a table, say, 'stories', with the following two fields:
starts_at, 4 digits: "MMDD" - month and date ends_at, 4 digits: "MMDD" - month and date How would I do a select that returned the entries where todays date expressed as MMDD is in the timespan that starts_at and ends_at covers? BETWEEN is OK for case 1, but not for case 2: starts_at (case 1) ends_at |--------------------| |-jan-feb-mar-apr-may-jun-jul-aug-sep-oct-nov-dec-| -----| |--------------- ends_at (case 2) starts_at (If the layout is screwed, try this: http://trueaffection.net/blabla/sql-date.txt) Thanks. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|