select distinct 
    agent_id,
    dialogs_id,
    member_id,
    content,
    `timestamp`
from
    biz_agent_application_dialogues_record
where is_deleted ='N'
<< and member_id= :memberId>> 
group by dialogs_id
order by `timestamp` desc