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

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -