ÎÒÒªµÄ½á¹ûÊÇ £º id name gongzi 1 ÕÅÈý 3000 2 ÀîËÄ 5000 3 ÍõÎå 3000
ÕâÑùµÄSQL ÔõÃ´Ð´ÄØ£¿select name,¹¤×Ê=sum(¹¤×Ê) from tb group by name select name,sum(gongzi) from tb group by name select name,gongzi=sum(gongzi) from tb group by name ... SQL code: select name,sum(gongzi) as gongzi from tb group by name
SQL code: ²ä·Ö select [name], ¹¤×Ê=sum(¹¤×Ê) from tb group by name
ͬÉÏ SQL code: create table tb(id int,name varchar(10),gongzi int) insert into tb select 1 ,'ÕÅÈý', 1000 union all select 2 ,'ÀîËÄ', 2000 union all