我有一张桌子,我想将某些行与删除重复的行连接起来,并对那些重复的行求和。
sql服务器
SELECT DISTINCT ST2.DistrictName
,ST2.MandName
,ST2.MandalCode
,ST2.VillageName
,ST2.VillageCode
,ST2.basesurveyno
,ST2.TotalExtent
,(
SELECT ST1.SurveyNo + '/' AS [text()] and '/' as [sum()]
FROM Sheet1$ ST1
WHERE ST1.basesurveyno = ST2.basesurveyno
and ST1.VillageName = ST2.VillageName
FOR XML PATH ('')
)
FROM Sheet1$ ST2
我想一次删除各行中的重复项,以连接其他行,并对某些行加总。