controlling output from a group by clause
Posted on 2011-02-15
If i have a table with columns A,B,C,D and run this query
select (*) from table group by A,B
I believe mysql gives random values for the columns C and D from any member of the group. Is there anyway I can control that. For example if i have
select max(C) , D from table group by A,B
can you get the value for column D anyhow from the row (or any of the rows) in the group that have the maximum value for column C?