UPDATE my_reports AS A
INNER JOIN (SELECT id, COUNT(id) AS count FROM my_reports GROUP BY id) AS B
ON A.id = B.id
SET A.count = B.count;
This query is updating the count as 1 each row, because we have unique id, I don't want to count the id, but I want user_id(which is another column). Tried using Right Join but not able to update
id user_id count
1 33 ? (required 2)
2 33 ? (required 2)
3 44 ? (required 1)
4 45 ? (required 1)