September 8, 2014 at 1:59 pm
Create table #Check
( Date Date ,
Amount money
)
Insert into #Check values ( '04/21/2012','2000')
Insert into #Check values ( '04/21/2012','3000')
Insert into #Check values ( '04/21/2012','1000')
Insert into #Check values( '04/21/2012','4000')
Insert into #Check values ( '04/21/2012','2000')
Insert into #Check values ( '04/21/2012','5000')
Insert into #Check values ( '04/21/2012','2000')
Insert into #Check values( '04/21/2012','1000')
select sum(amount) as Amount , sum(amount)/2 as Contribution , sum(amount)/2 as Withdrawal from #Check
select * from #Check
I want to find out what combination of entries from table #check , makes up Contibution and Withdrawal of 10000.00 each
eg Sum of both contribution and withdrawal is 10000
Contributions
4/21/20122000
4/21/20123000
4/21/20121000
4/21/20124000
Withdrawal
4/21/20122000
4/21/20125000
4/21/20122000
4/21/20121000
Thanks
September 9, 2014 at 7:20 am
Please don't cross post. It fragments replies and makes it a lot harder to help you. Please direct replies here. http://www.sqlservercentral.com/Forums/Topic1611592-3077-1.aspx
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply