-2
我需要一個sql語句的幫助。我有一個基於'likes'的精選用戶系統,但是一旦用戶被「推薦」,他們將無法在未來30天內進行推介。這已經完全寫在php/mysql中。有任何想法嗎?基於日期的MySQL查詢
我需要一個sql語句的幫助。我有一個基於'likes'的精選用戶系統,但是一旦用戶被「推薦」,他們將無法在未來30天內進行推介。這已經完全寫在php/mysql中。有任何想法嗎?基於日期的MySQL查詢
僞代碼:
$new_date = new DateTime;
$new_date->modify('30 day'); //set the next time they can be featured to 30 days in the future
while ($row = $qryResult ->fetch_assoc()) { //query table containing user, featured yes/no, date, etc
$featured_date = new DateTime($row['featuredDate']);
if ($featured date < $new_date) {
echo $row['user'];
}
}
[?你嘗試過什麼(http://www.whathaveyoutried.com/)參見[問諮詢】(http://stackoverflow.com/問題/問題諮詢)。 – 2013-02-21 20:22:55
在哪裏說sql語句? – 2013-02-21 20:25:19
'select ... where(featured + interval 30 day)
2013-02-21 20:30:59