SELECT * FROM tablename.questions
where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <=date(from_unixtime(question_created))
order by question_click_count desc
;
顯示7天數據
我能做到這一點在PHP這樣
在php或mysql中相同的結果,哪種方式更好?
$day = mktime(0,0,0,date("m"),date("d")-7,date("Y"));
然後查詢SQL
select * from 'question'
where question_created < $day and XXXXXXX
哪種方式是更好的辦法?