Perhaps the examples here would help you:
http://dev.mysql.com/doc/refman/5.0/en/date-calculations.html 

> -----Original Message-----
> From: Noel Butler [mailto:noel.but...@ausics.net] 
> Sent: Saturday, December 26, 2009 6:47 PM
> To: mysql@lists.mysql.com
> Subject: anniversary selects
> 
> Hi,
> Hope we all had a great Christmas!
> 
> I am trying to run a query that selects a member every 365 days so we
> can send them a domain reminder.
> For my test (because i'm too lazy to count out someone with 
> hundreds of
> days :) ) I am using a known member at around 27/28 days
> 
> Now if I use this if finds the member, it doesn't find them if I go
> under to say 27 days, I've used the DATE_SUB many times before, but
> never for an exact match.
> 
> SELECT * FROM `member` WHERE AddedOn>=DATE_SUB(CURDATE(), INTERVAL 28
> DAY)
> 
> Now trying to get an exact match, fails.
> SELECT * FROM `member` WHERE AddedOn=DATE_SUB(CURDATE(), INTERVAL 28
> DAY)
> 
> Also tried one by one up to 30 and down to 25 days, 
> 
> Would someone please mind slapping me a good one reminding me 
> what I've
> done wrong :)
> I thought CURDATE ignored the  hours/mins/secs etc, but it 
> seems it does
> not?
> 
> Thanks
> Noel
> 
> 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to