在asp读数据库的记录时,让重复的记录只显示一条,并把一个字段相加

2024-11-14 14:31:45
推荐回答(5个)
回答1:

select id,name,isnull(sum(work),0) as work from 表 group by id,name

回答2:

SELECT id,name,isnull(sum(work),0) AS work FROM 表 GROUP BY name

回答3:

select DISTINCT id,name,isnull(sum(work),0) as work from table group by id,name

回答4:

用SQL可以实现!

SELECT name,sum(work) as worksum FROM 表名 GROUP BY name

如果还想按work的数据排序

SELECT name,sum(work) as worksum FROM 表名 GROUP BY name ORDER BY worksum

回答5:

dasdf