Querying for a time period between a time period
I'm having problems with MySql while trying to search for a time period
between a time period. I'm going to explain better:
I have a table which stores allocation data for a resource in some
projects. You can see the table and code below.
SELECT * FROM ALLOCATION
WHERE dt_starting >= STR_TO_DATE('2013-09-02', '%Y-%m-%d')
AND dt_ending <= STR_TO_DATE('2013-09-06', '%Y-%m-%d')
AND id_res = 1;
id_alloc id_pro id_res dt_starting dt_ending
----------
1 1 1 2013-09-02 2013-09-06
2 2 1 2013-09-03 2013-09-04
----------
However when I try to search using a date period from 2013-09-05 to
2013-09-05 or even from 2013-08-31 to 2013-09-03 I receive null in all
fields.
Certainly it's a logic problem but it's driving me crazy.
No comments:
Post a Comment