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 2000 Forums
 Transact-SQL (2000)
 join two tables

Author  Topic 

QuietRiot
Yak Posting Veteran

67 Posts

Posted - 2007-11-16 : 12:36:57
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 - 2007-11-16 : 12:47:45
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 - 2007-11-16 : 13:56:38
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'
Go to Top of Page

QuietRiot
Yak Posting Veteran

67 Posts

Posted - 2007-11-17 : 13:22:53
I edited the above to make more sense. Any help?

Go to Top of Page
   

- Advertisement -