- date: documentation ( source)
- strtotime: documentation ( source)
<?php
$yesterday = date('Y-m-d', strtotime("-1 days"));
$sql = "SELECT fc.forum_id,count(fc.forum_id)as total_comments ".
"FROM ForumComments as fc ".
"WHERE $yesterday <= fc.updated_at ".
"GROUP BY fc.forum_id ".
"ORDER BY total_comments DESC ";
echo($sql);