Cory,

> time_period_id int(11) NOT NULL auto_increment,
> time_period_start date NOT NULL default '0000-00-00',
> time_period_end date NOT NULL default '0000-00-00',
> PRIMARY KEY  (time_period_id)

> I am trying to get the ID that relates to a date falling between the
> range of time_period_start(2003-03-01) and time_period_end(2003-03-15):

> $sql = SELECT time_period_id FROM time_periods
> WHERE 2003-03-14 BETWEEN time_period_start AND time_period_end;

SELECT time_period_id FROM time_periods
 WHERE time_period_start >= '2003-03-01'
   AND time_period_end   <= '2003-03-15'
;

should do the job.

Regards,
--
  Stefan Hinz <[EMAIL PROTECTED]>
  iConnect GmbH <http://iConnect.de>
  Heesestr. 6, 12169 Berlin (Germany)
  Telefon: +49 30 7970948-0  Fax: +49 30 7970948-3

[filter fodder: sql, mysql, query]


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to