LEFT JOIN rb_department AS d ON A.Dept_Id=d.DeptId
LEFT JOIN rb_department AS d ON A.Dept_Id=d.DeptId
LEFT JOIN rb_post AS p ON A.Post_Id=p.PostId
LEFT JOIN rb_post AS p ON A.Post_Id=p.PostId
LEFT JOIN (SELECT AccountId,AccountType,MAX(Content) as AccountRemark from rb_accountremark where Group_Id=100000 and `Status`=0 GROUP BY AccountId,AccountType ORDER BY CreateTime desc)
LEFT JOIN (
as ar on a.AccountId=ar.AccountId and A.AccountType=ar.AccountType
SELECT AccountId,AccountType,MAX(Content) AS AccountRemark
WHERE 1=1 {4}
FROM rb_accountremark
WHERE `Status`=0
GROUP BY AccountId,AccountType
ORDER BY CreateTime DESC
) AS ar on a.AccountId=ar.AccountId AND A.AccountType=ar.AccountType