MySQL DATE_FORMAT comparison to CURDATE() query...

Posted by Crazy Serb on Stack Overflow See other posts from Stack Overflow or by Crazy Serb
Published on 2010-03-15T03:55:00Z Indexed on 2010/03/15 3:59 UTC
Read the original article Hit count: 199

Filed under:
|
|

Hey guys, I am just trying to pull all the records from my database who have a rec_date (varchar) stored as m/d/Y and are expired (as in, less than curdate()), and this call isn't giving me what I want:

SELECT member_id, status, DATE_FORMAT(STR_TO_DATE(rec_date, '%m/%d/%Y'), '%Y-%m-%d') AS rec FROM members WHERE rec_date > CURDATE() AND status = '1'

I'm obviously doing something wrong, so can you help?

Thanks.

© Stack Overflow or respective owner

Related posts about dateformat

Related posts about mysql