Hi i have tables like this :
table entry :
id | total_comments _____________________ 1 | 0 2 | 0 3 | 0 4 | 0
Use:
UPDATE entry SET total_comments = (SELECT COUNT(*) FROM COMMENTS c WHERE c.eid = id GROUP BY c.eid) WHERE id IN ( SELECT eid FROM comments WHERE id IN (1,2,3,4,5,6))