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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 sum result
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Joetaniarto00
Starting Member

Indonesia
12 Posts

Posted - 02/19/2015 :  23:11:21  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

2780 Posts

Posted - 02/20/2015 :  09:46:50  Show Profile  Reply with Quote
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

USA
37 Posts

Posted - 04/02/2015 :  05:58:16  Show Profile  Reply with Quote
unspammed
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000