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
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 sum result

Author  Topic 

Joetaniarto00
Starting Member

12 Posts

Posted - 2015-02-19 : 23:11:21
Hi all,
I have data as below :
ID Trans. ID2.Tr Begin in out left
14010011 C016988 1300000 0 500000 1300000
14010011 C016999 5200000 3750000 550000 1450000
14010011 C017009 1300000 1000000 250000 300000
14010011 C017034 2600000 2600000 0 0

I want to make result only on record which has 1300000 value on begin value as the filter so result contain of :

ID Trans. ID2.Tr Begin in out left
14010011 C016988 1300000 0 500000 1300000
14010011 C017009 1300000 1000000 250000 300000

and than I want to make final result as :

ID Trans. Begin in out left
14010011 1300000 1000000 750000 1600000

please help..

thanks

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-02-20 : 09:46:50
select [id trans.], [id2.tr], begin, sum(in) in, sum(out) out, sum(left) left
from table
where [begin] = 1300000
group by [id trans.], [id2.tr], begin
Go to Top of Page

huangchen
Starting Member

37 Posts

Posted - 2015-04-02 : 05:58:16
unspammed
Go to Top of Page
   

- Advertisement -