2014-10-07 52 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 
相關問題