php - How to select the latest version of answers given by each answerer in MySQL? -


A scenario is an inquiry and reply website. A responder can modify his answer, and save the history of the revision on the server. goes. Be default, only the latest version of each answer is displayed. Answerer_id by questionnaire = '$ questionid' select from the answer of the group * so I can group all the answers by answerer, so I need to choose the latest version of each subgroup get receive?

The group by clause only starts using the first available row, so that you can sub-query Try to regenerate them using the latest answer to the top. Answerer_id by `dyn_answers` group as

  SELECT * FROM (SELECT * FROM from 'Answer' Where Q = '$ questionid' by ansverrer_id DESC) 

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

jquery - SimpleModal Confirm fails to submit form -