select cca.agentname,mca.agentname FROM tbDCusCardS cc
INNER JOIN tbMCardS mc ON cc.CardSNo = mc.CardSNo
LEFT JOIN tbMAgent cca ON cc.AgentID = cca.AgentID
LEFT JOIN tbMAgent mca ON mc.AgentID = mca.AgentID
FROM tbDCusCardS cc
INNER JOIN tbMCardS mc ON cc.CardSNo = mc.CardSNo
LEFT JOIN tbMAgent cca ON cc.AgentID = cca.AgentID
LEFT JOIN tbMAgent mca ON mc.AgentID = mca.AgentID