SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 join two tables
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

QuietRiot
Yak Posting Veteran

67 Posts

Posted - 11/16/2007 :  12:36:57  Show Profile  Reply with Quote
select * from dbo.FundTransactionLines where postingdate = '2007-11-01'


select * from subaccountcurrentholdings


i only need totalshares from subaccountcurrentholdings and I need everything from fundtransactionlines

they both have accountnumber and FundId in common

want this displayed as 1

thanks


anonymous1
Posting Yak Master

185 Posts

Posted - 11/16/2007 :  12:47:45  Show Profile  Reply with Quote
fields and a good definition of the desired results would be more helpful, here is a guess from the limited information...
select *
from dbo.FundTransactionLines
left join
(
select fundid, sum(shares) as totalshares
from dbo.subaccountcurrentholdings
group by fundid
) as totalshares
on totalshares.fundid = dbo.FundTransactionLines.fundid
where dbo.FundTransactionLines.postingdate = '2007-11-01'
Go to Top of Page

QuietRiot
Yak Posting Veteran

67 Posts

Posted - 11/16/2007 :  13:56:38  Show Profile  Reply with Quote
Ok,

so I need AccountNumber, FundId, ProcessingDateTime, TransactionID, CustomTransactionCode, TradeDate, PricerPerShare, GrossAmount, NetAmount, ShareAmount, FeeAmount

from Table: FundTransactionLines

then I want to add TotalShares from the SubAccountCurrentHoldings table based on AccountNumber and Fundid from transactionLines table.

also I need it where FundTransactionLines.postingdate = '2007-11-01'

Edited by - QuietRiot on 11/17/2007 13:21:56
Go to Top of Page

QuietRiot
Yak Posting Veteran

67 Posts

Posted - 11/17/2007 :  13:22:53  Show Profile  Reply with Quote
I edited the above to make more sense. Any help?

Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.09 seconds. Powered By: Snitz Forums 2000