> update a from b such that a.maxtype is set equal to the b.type whose val
> number is the highest for that matching id, that is, the result
How about:
update a set maxtype = (select type from b where b.id = a.id order by val
desc limit 1);
?
Regards,
Bjoern