I think you want this to be a dynamic query instead of updating the member table:
select username, count(username)*100 as money
from forum
group by username
order by username
if you must have it in a member table, then this query can be used in your update, as shown below:
update members m
set money = (select count(username)*100 from forum f where f,username = m.username )
Another problem here - when to do the update - this is best done in a trigger, so that it looks more like a parameterized statement only for the current username in the current forum insert.
Hth
Randy source
share