Welcome Guest, Not a member yet? Register   Sign In
mysql select where date is < this month/year
#1

[eluser]megabyte[/eluser]
I'm sure there a re few ways, but rather than do it thewrong way I thought I'd ask for help.



Looking to select from table where results will be older than the current month/year
#2

[eluser]kiedis[/eluser]
Hi,

Dates al least one year/month older than current date
Code:
SELECT mytable.* FROM mytable WHERE my_date_field < DATE_SUB(CURDATE(), INTERVAL 1 YEAR)
SELECT mytable.* FROM mytable WHERE my_date_field < DATE_SUB(CURDATE(), INTERVAL 1 MONTH)


DATE_SUB function help




Theme © iAndrew 2016 - Forum software by © MyBB