Get mysql rows where date timestamp is 30 days or newer -
i trying bunch of mysql rows last 30 days using sql:
select * `articles` date >= date(now() - interval 30 day) order `views` desc
i doing wrong returns rows last year.
my date field in gmt timestamp.
if date field not datetime
, timestamp
, or date
field type (as think you're indicating "in gmt timestamp" - suspect you're storing integer itself), you're not going able comparison that. you'd need convert 30 days ago date timestamp too.
where date >= unix_timestamp(date(now() - interval 30 day))
Comments
Post a Comment