问题描述:

I have two fields in my DB table a start_time and and end_time example:

start_time: 2013-04-20 13:07:00

end_time: 2013-04-20 12:07:00

my query currently contains

 where `start_time` >= '2013-04-20 14:13:20' AND `end_time` <= '2013-04-20 18:13:20'

which due to the way the query is the start_time: 2013-04-20 13:07:00 will not pull in the result so I am seeking idea of how to compensate for that. The time thats generated for the pull already sets the time back an hour from the current time, and sets the end time to 4 hours from the current time.

网友答案:

don't use >= and <= in query use some thing like this to fix it. where (start_time > '2013-04-20 14:13:20' or start_time = '2013-04-20 14:13:20' ) AND (end_time < '2013-04-20 18:13:20' or end_time = '2013-04-20 18:13:20')

相关阅读:
Top