update statistic2 as s set hits = hits + (select count(*) from content_hit as h1 where s.user_id=h1.user_id and s.content_id = h1.content_id), unique_hits = unique_hits + (select sum(numips) from (select count(distinct(h2.ip)) as numips from content_hit as h2 where content_hit.user_id=s.user_id and content_hit.content_id=s.content_id and posted=1 and valid=1 group by year(created_date), month(created_date), day(created_date)) ), clicks = clicks + (select count(*) from content_click as c1 where s.user_id=c1.user_id and s.content_id = c1.content_id), unique_clicks = unique_clicks + (select sum(numips) from (select count(distinct(c2.ip)) as numips from content_click as c2 where c2.user_id=s.user_id and c2.content_id=s.content_id and active=1 group by year(created_date), month(created_date), day(created_date) ));