SELECT * FROM tablename.questions
where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <=date( from_unixtime(question_created))
order by question_click_count desc
;
要显示 7 天的数据,
我可以像这样在 php 中执行此操作
$day = mktime(0,0,0,date("m"),date("d")-7,date("Y"));
然后查询sql
select * from 'question'
where question_created < $day and XXXXXXX
哪种方式更好?