Fw: Date Add
| From: | John Fishworld | Date: | Sun, 04 Aug 2002 15:30:31 +0000 |
| Subject: | Fw: Date Add | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-20978@lists.php.net to get a copy of this message | ||
> I thought I had this working, but it seems unfortunately not !!!
>
> I'm trying to list events for each month and my select query is as follows
>
> SELECT DISTINCT t_city_name,t_city_id_city FROM
> t_city,t_zipcodecity,t_location,t_event WHERE (t_city_id_city =
> t_zipcodecity_id_city) AND (t_zipcodecity_zipcode = t_location_zipcode )
AND
> ((t_location_sex = 4) OR (t_location_sex = 6) OR (t_location_sex = 0)) AND
> (t_location_id_location = t_event_id_location) AND (t_event_date <
> (DATE_ADD('2002-08-01 00:00:00', INTERVAL 31 day)) ) AND (t_event_date >
> '2002-08-01 00:00:00') ORDER by t_city_name
>
> this is for August and seems to work fine, but my problem is that in the
> running month I only want to show the still forthcoming events so for
today
> July the 31 st my query looks like this
>
> SELECT DISTINCT t_city_name,t_city_id_city FROM
> t_city,t_zipcodecity,t_location,t_event WHERE (t_city_id_city =
> t_zipcodecity_id_city) AND (t_zipcodecity_zipcode = t_location_zipcode )
AND
> ((t_location_sex = 4) OR (t_location_sex = 6) OR (t_location_sex = 0)) AND
> (t_location_id_location = t_event_id_location) AND (t_event_date <
> (DATE_ADD('2002-07-31 00:00:00', INTERVAL 0 day)) ) AND (t_event_date >
> '2002-07-31 00:00:00') ORDER by t_city_name
>
> But it doesn't work ??
> Can anyone give me a hint in the right direction ??
> The problem is definately in the last part ---- (t_event_date <
> (DATE_ADD('2002-07-31 00:00:00', INTERVAL 0 day)) ) AND (t_event_date >
> '2002-07-31 00:00:00')
>
> Thanks in advance
>
>
>
>