How do I find if date 'MMDD' is covered by timespan covered byTIME_START and TIME_END ?

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 ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-26-2008
harry
 
Posts: n/a
Default How do I find if date 'MMDD' is covered by timespan covered byTIME_START and TIME_END ?

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.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:00 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0