0
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

if Today is 2010-10-16..

how can I get results work in today.

2    http://google.com     2010-10-15    2010-12-11
4    http://espan.com      2010-10-01    2011-01-01
2
  • data types of start and end? Commented Dec 13, 2010 at 9:11
  • 2010-10-17 is greater than 2010-10-10. The start date is supposed to be less than/equal to end date, right? Commented Dec 13, 2010 at 9:14

3 Answers 3

2
SELECT id, url, start, end
FROM Your_Table
WHERE 2010-10-16 BETWEEN start AND end

Replace 2010-10-16 with CURRENT_TIMESTAMP or equivalent in MySQL

Sign up to request clarification or add additional context in comments.

Comments

2
SELECT * FROM your_table WHERE CURDATE() >= start AND CURDATE() <= end

Comments

1

Something like this?

SELECT *
FROM that_table
WHERE CURRENT_TIMESTAMP BETWEEN start AND end

Note that:

  1. in the above example, both dates are "inclusive"
  2. in the above example, CURRENT_TIMESTAMP includes the "time" part as well

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.