There is a scenario. There is an ask-and-answer website. An answerer can modify his answer, and the history of modification is saved on the server. Be default, only the latest version of each answer is displayed.
select * from answers where questionid='$questionid' group by answerer_id
So I can group all answers by answerer, then I need to select the latest version of each subgroup. How to achieve this?