select a.agentno,sum(a.last_amt),sum(b.amount2),c.nodeno,c.nodename,c.brno,a.tellerno from todayagentlist a,todaymainlist b,Brnodetable c
   where a.agentno=b.agentno and a.brno=c.nodeno and a.tellerno=b.tellerno 
   group by a.tellerno,a.agentno,c.nodeno,c.nodename,c.brno;改成这样就可以了