mysql - Get rows that are less than 10 years old from the beginning of the year -
i'm using code date > timestampadd(year, -10, now()) return data less 10 years old.
i need january 1, 2007 instead of july 28, 2007 (10 years ago now())
was hoping date > timestampadd(year, -10, year(now())) work, doesn't.
how can accomplish this?
just create date need using str_to_date():
year(now) give year.
then build like:
select str_to_date(concat(year(now()), '/01/01'), "%y/%m/%d")
Comments
Post a Comment