Hello Bruno,

its a little bit complicated. You have to put a little bit of brain in it!

The situation you ask for is:

tab2.interval                   <--------------------------->
possible intervals of table 1, which should be displayed are:
1.                      <----------------------->
2.                                              <------------------>
3.                                                              
<-------------------------->
4.                      <----------------------------------------------------------->

Now you have to write four parts of where-clauses which describe each of
this situtation and you have to connect them with an OR

select * from tab1, tab2 where (where clause for situation 1) OR (where
clause for situation 1) OR ...

and the where clauses look like this (situation 1):
        (tab1.date_from <= tab2.date_from AND tab1.date_from <= tab2.date_to) AND
(tab1.date_to >= tab1.date_from AND tab1.date_to <= tab2.dat_from)

and so on with situation 2,3 and 4.

Maybe it isn´t a efficient way, but it should be possible.

Greetings

Michael

PS: Don´t forget the brakets


-----Ursprüngliche Nachricht-----
Von: Bruno Grampa [mailto:[EMAIL PROTECTED]]
Gesendet: Freitag, 5. Oktober 2001 12:34
An: [EMAIL PROTECTED]
Betreff: Date interval problem


Hello,
i have a table with two dates, that define an interval.
In the query i have two more dates, and i want to select all the records
that overlap that period.
Any hint to solve this problem?

Thanks,
   Bruno

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


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