Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 SQL Server 6.5 \ SQL Server 7.0
 Sum of Filelds

Author  Topic 

danasegarane76
Posting Yak Master

242 Posts

Posted - 2007-03-22 : 07:13:35
Dear All,
How to get the sum of fieldb.[fsize][red] from this code

"select b.[Filename],b.[FilePath],b.[fileid],b.[fsize],b.[modifieddate],a.[softID],a.[softName],a.[displayName],a.[Softpath],a.[type] from wms_mstOld b,mstNew a where a.softid=b.softid and a.softid in" & sSoftwareidlist


Thanks in Advance
Dana

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-03-22 : 11:21:02
You use GROUP BY keyword and SUM function.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

danasegarane76
Posting Yak Master

242 Posts

Posted - 2007-03-23 : 02:10:01
Dear Peter,
I am trying like this.But I am gettting error.Can you please help


select b.[Filename],b.[FilePath],b.[fileid],sum(b.[fize]),count(*),b.[fsize],b.[modifieddate],a.[softID],
a.[softName],a.[displayName],
a.[Softpath],a.[type] from wms_mstOld b,mstNew a where a.softid=b.softid and a.softid in (1) group by b.[FileName]
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-03-23 : 06:52:08
select b.[Filename], sum(b.[fize]),count(*),a.[softName],a.[displayName],
from wms_mstOld as b
inner join mstNew as a on a.softid = b.softid and a.softid = 1
group by b.[FileName]



Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -