We want to extract only the last calls rescheduled(reason 2) with their comments from the table:

Here is the method i used:

SELECTt1.id_client,t1.or_res,t2.`comment`,call_reasonFROM(SELECTMAX(call_back_hour) as or_res,id_clientfrom ai_callsWHERE call_reason =2GROUP BY id_client) as t1LEFT JOIN ai_calls as t2 on t1.id_client=t2.id_client and t1.or_res=t2.call_back_hour