2014-10-07 64 views
0

首先这很奇怪,我甚至找不到这个问题的完美标题。下面是这种情况:从mysql获取记录发生在特定日期

这是我的事件表结构:

id start_date end_date 
1 2014-10-13 2014-10-24 
2 2014-10-16 2014-10-18 
3 2014-11-17 2014-11-20 

现在我的用户输入特定的日期。例如2014-10-20。他需要在特定日期进行的所有事件。如何实现这一目标?

回答

1

试试这个:

select * 
    from event_table 
where date'2014-10-20' >= start_date 
    and date'2014-10-20' <= end_date 
+0

是完美的。谢谢! – 2014-10-07 10:44:59

3
select * from your_table 
where '2014-10-20' between start_date and end_date 
相关问题