SELECT uid,uname,
day(bdate) as dayn,
month(bdate) as mthn
FROM birth
WHERE month(bdate)=month(now())
AND day(bdate)
BETWEEN day(now())
AND day(now())+7
The Select statement above is a piece of php script, it select userid,user name,birth date from birth table with condition that date range should be today's date and seven more days (that is birth date falling with in week)
"birth" table is :-
+------+-----------+------------+
| uid | uname | bdate |
+------+-----------+------------+
| 101 | sameer | 1976-09-11 |
| 102 | Bir | 1976-01-14 |
| 103 | Milind | 1976-10-24 |
| 104 | shekhar | 1987-02-18 |
| 1 | today | 2006-03-27 |
| 2 | today | 2006-03-27 |
| 105 | Neena | 2006-03-19 |
| 3 | tomorrow | 2006-03-20 |
| 4 | tomorrow | 2006-03-22 |
| 5 | range out | 2006-03-30 |
+------+-----------+------------+
10 rows in set (0.11 sec)
All you have to do is, replace select with proper delete along with condition and decide how to set the job done either by shell script and procedure or from php or any other way.
Hope it may help you.
Regards
Milind
|