dimanche 31 août 2014

Date between dates, ignore year


Vote count:

0




What's the best (fastest) approach to compare if date is in range of dates independently from year?


table "dates":



some_column| since | upto |
-----------|--------------|-------------|
'foo' | '2011-05-01' | '2013-06-01'|


Now I want this query to return 'foo'



SELECT foo FROM dates WHERE '2014-05-05' BETWEEN `since` AND `upto`


If needed, I can change format of stored dates in "dates" table, but I cannot change format of date which I put into query as that value is typically from another table (It's part of more complex query using joins).



asked 56 secs ago







Date between dates, ignore year

Aucun commentaire:

Enregistrer un commentaire