表的结构是:
uid username truename
1 aaaa 张三
2 bbbb 李四
uid counr IP
1 1 123.123.123.123
1 1 221.112.31.2
1 1 121.112.31.2
2 1 12.234.153.12
帐号 姓名 点击
aaaa 张三 3
bbbb 李四 2
cccc 王二 0
用一条sql语句查询出来。
[code="java"]
select t1.username as 帐号 ,t1.truename as 姓名 ,sum(t2.counr) as 点击 from user t1,counts t2
where t1.id=t2.id
group by t1.username,t1.truename
[/code]