这是我的查询
SELECT agent.agtname AS `agent_name`, agent.id as `agent_id`, applicant.*
FROM `applicant`
LEFT JOIN agent ON agent.id = applicant.agtid
WHERE agent.branchid ='".$branch_id."'
AND applicant.appt_status LIKE '%SENT%'
AND DATE(`modifiedon`) = CURDATE()
我不需要重复的agent_name以及agent_id ..
提前致谢
答案 0 :(得分:1)
让我们试试吧。 它会起作用......
SELECT agent.agtname as agent_name,agent.id as agent_id, applicant.* FROM applicant LEFT JOIN agent ON agent.id = applicant.agtid WHERE agent.branchid ='".$branch_id."' AND applicant.appt_status LIKE '%SENT%' AND DATE(modifiedon) = CURDATE() GROUP BY agent.agtname