I want to perform a case update, unfortunately I am getting an error that tells me that am making an Invalid use of group function
Error Code: 1111. Invalid use of group function
update l, m
set l.requests = sum(
case when m.event = 'rRequested' then
m.id end )
where
l.id = m.id
or
update l, m
set l.requests = (
case when m.event = 'rRequested' then
count(m.id) end )
where
l.id = m.id
Any idea how can i fix this?
I could do a full select after the set, but i want to learn how to use (even if it's possible) the case update for aggregations...