select max( sum(duration) ),cd from rent group by cd;
.
ERROR 1111 (HY000): Invalid use of group function
select max( sum(duration) ),cd from rent group by cd;
.
ERROR 1111 (HY000): Invalid use of group function
that query is very broken. firstly, i don't think you can put a max around sum... 2nd you are grouping on a column "cd" which isn't in the selected columns.
I suggest doing some/many tutorials from here
From documentation - group (aggregate) functions that operate on sets of values.. SUM returns scalar value.
Is this what you want?