1104: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay<br />SELECT a.* , COUNT(DISTINCT(b.id)) as daily_visits , COUNT(DISTINCT(c.id)) as total_visits FROM `ws_friends` a LEFT JOIN `ws_friends_referrals` b ON (b.friend_id=a.id AND NOW()<DATE_ADD(b.`created`, INTERVAL 1 DAY) ) LEFT JOIN `ws_friends_referrals` c ON (c.friend_id=a.id ) WHERE 1 GROUP BY a.id ORDER BY daily_visits DESC, a.`sort_order` ASC
error