id url start end
1 http://yahoo.com 2010-10-17 2010-10-10
2 http://google.com 2010-10-15 2010-12-11
3 http://espan.com 2010-10-20 2011-01-20
4 http://espan.com 2010-10-01 2011-01-01
如果今天是2010-10-16
..
如何才能让结果在今天发挥作用。
2 http://google.com 2010-10-15 2010-12-11
4 http://espan.com 2010-10-01 2011-01-01
答案 0 :(得分:2)
SELECT id, url, start, end
FROM Your_Table
WHERE 2010-10-16 BETWEEN start AND end
将2010-10-16
替换为CURRENT_TIMESTAMP或MySQL中的等效项
答案 1 :(得分:2)
SELECT * FROM your_table WHERE CURDATE() >= start AND CURDATE() <= end
答案 2 :(得分:1)
这样的东西?
SELECT *
FROM that_table
WHERE CURRENT_TIMESTAMP BETWEEN start AND end
请注意: