Forum Moderators: open
i tried adding "AND WHERE community="community A" at the end, but gave me an error.
$sql = 'SELECT COUNT(last_visit) AS last_visit, (SELECT COUNT(*) FROM registration_table WHERE DATE_SUB(CURDATE(),INTERVAL 6 DAY) <= entry_time) AS totalcount FROM registration_table WHERE DATE_SUB(CURDATE(),INTERVAL 6 DAY) <= last_visit';
$sql = 'SELECT COUNT(community) AS comm_count, (SELECT COUNT(*) FROM registration_table WHERE DATE_SUB(CURDATE(),INTERVAL 6 DAY) <= entry_time AND community=\'Sonata\') AS totalcount, (SELECT COUNT(last_visit) FROM registration_table WHERE DATE_SUB(CURDATE(),INTERVAL 6 DAY) <= last_visit AND community=\'Sonata\') AS last_visit FROM registration_table WHERE DATE_SUB(CURDATE(),INTERVAL 6 DAY) <= entry_time AND community=\'Sonata\'';
i had to add "AND community=\'Sonata\'" to each statement.