I need a bit of assistance on an update statement. I have the following query
update totals
set contacts = (SELECT
COUNT(*)
FROM contact_events c
JOIN users u
ON c.user = u.id
GROUP BY c.user)
where c.user = ext_id;
But when I run it I get 'unknown column c.user in where clause'.
However, I can't seem to apply an alias on that join so I must be doing something wrong here with syntax.