finding if an anniversary is coming up in n days in MySql
Posted
by user151841
on Stack Overflow
See other posts from Stack Overflow
or by user151841
Published on 2010-05-20T14:39:56Z
Indexed on
2010/05/20
14:50 UTC
Read the original article
Hit count: 128
I have a table with anniversary dates. I want a query that returns me rows of anniversaries coming up in the next 10 days. For instance:
birthdate
---------
1965-10-10
1982-05-25
SELECT birthdate FROM Anniversaries WHERE mystical_magical_mumbo_jumbo <= 10
+------------+
| birthdate |
+------------+
| 1982-05-25 |
+------------+
1 row in set (0.01 sec)
I'd like to keep the query in the form x <= 10
, because I'll use that number 10 in other parts of the query, and if I set it to a variable, I can change it once everywhere by changing the variable, and not have to re-write the query.
© Stack Overflow or respective owner