List:General Discussion« Previous MessageNext Message »
From:Daevid Vincent Date:December 28 2009 10:53pm
Subject:RE: anniversary selects
View as plain text  
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.butler@stripped] 
> Sent: Saturday, December 26, 2009 6:47 PM
> To: mysql@stripped
> 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
> 
> 

Thread
anniversary selectsNoel Butler27 Dec
  • RE: anniversary selectsDaevid Vincent28 Dec
    • RE: anniversary selectsNoel Butler29 Dec