Re: Check date interval in SELECT

2006-10-29 Thread David Thole

I'm not 100% sure I'm understanding your requirements, but this query:

select id from datetest where date_in not between '2006-09-05' and  
'2006-09-21' and date_out not between '2006-09-05' and '2006-09-21';


should do exactly as you want for getting id3 if I'm understanding  
the requirements correctly and that's the idea that you want an event  
that doesn't start  or end in that interval.


-David Thole

On Oct 29, 2006, at 4:14 AM, spacemarc wrote:


Hi
I have 3 fields like this:

id  date_in  date_out
1   2006-09-05   2006-09-10
2   2006-09-15   2006-09-20
3   2006-09-25   2006-09-30

Example: if I have an time interval like '2006-09-05' and  
'2006-09-21',

I have to search, in the same time, only the records that not included
in time interval and
that they are different is from date_in that from date_out.
In the example above, I would have to obtain only last record (id 3).

Thanks in advance

--
http://www.spacemarc.it

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Check date interval in SELECT

2006-10-29 Thread spacemarc

Hi
I have 3 fields like this:

id  date_in  date_out
1   2006-09-05   2006-09-10
2   2006-09-15   2006-09-20
3   2006-09-25   2006-09-30

Example: if I have an time interval like '2006-09-05' and '2006-09-21',
I have to search, in the same time, only the records that not included
in time interval and
that they are different is from date_in that from date_out.
In the example above, I would have to obtain only last record (id 3).

Thanks in advance

--
http://www.spacemarc.it

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]