mysql - Ask for really nasty PHP query (distinct dates from unixtime both in future and past) -


I have 1 table (s) that hold some unsuccessful Unix timestamps (dates); To:

ID.1 30-3-2011 (Wednesday) - Future

id.2 31-3-2011 (Thursday). - Future

On the other hand, there is another table (schedule), in which the column (date) also contains Unix timestamps - but in the past. For the above example, sessions are being conducted every Wednesday or Tuesday every week. Although the dates have been written in the past, using date_format (w), PHP aggregates them by the date of work ("W"), as there is no problem "for today".

Meaning

ID .44 15-3-2011 (Tuesday) - Past (3 weeks ago!)

id.45 25-3-2011 (Friday) - last

Now, the problem is to show them all that are added in future as "different dates and days"!

Today is Monday 28/3/2011 and the output should look like this.

++ Tuesday (29.3) ID .44

++ Wednesday (30.3) ID.1

++ Thursday (31.3.) ID.2 < / P>

++ Friday (1.4) ID .45

In fact, any thoughts? :)

Different questions of different dates are also welcome. Thanks!

How do you recognize "past" phenomena which are reproduced and should appear on these future The calendar of?

I think you've got a "repeat" flag on the incident record, then select something like

  ... from schedule time (eventdate now (     between DATE_ADD (now (), INTERVAL 1 week) or ((repeat = 1) and (eventdate & lt; now ())

Comments