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.
| Author |
Topic |
|
ghumph
Starting Member
2 Posts |
Posted - 2004-07-29 : 06:12:54
|
Does anyone have any ideas that would help me Im trying to get all the information about a clients transactions, firast I need to start with an opening balance and then get all the rest of the transactions for the month and display them in a VB data report Here is the statement the first part is the opening balance and the second part is the transactions, I want to be able to group them by fundsHere is the sp Ive done so far but this treats the transactions for each funds as though they are individual recordscreate proc CustomerTest5@idshareholder as integer,@startDate as datetime,@endDate as datetimeasSelect tblTAClientDetails.IDShareholder, tblFundDetails.FundName, sum(FinalShares) as stock, 'OpeningBalance' As Description, '' as IDTransaction, '' as tradedatefrom tblTATransactions inner join tblFundDetails on tblFundDetails.IDFund = tblTATransactions.IDFundinner join tblTAClientDetails on tblTAClientDetails.IDShareholder = tblTATransactions.IDShareholderwhere tblTAClientDetails.IDShareholder = @idshareholdergroup by tblFundDetails.FundName, tblTAClientDetails.IDShareholder, Description, tradedatehaving tradeDate < @startDateunionSelect tblTAClientDetails.IDShareholder, tblFundDetails.FundName, sum(FinalShares) as stock, transType As Description, IDTransaction, tradedatefrom tblTATransactionsinner join tblFundDetails on tblFundDetails.IDFund = tblTATransactions.IDFundinner join tblTAClientDetails on tblTAClientDetails.IDShareholder = tblTATransactions.IDShareholderwhere tblTAClientDetails.IDShareholder = 87group by tblFundDetails.FundName, tblTAClientDetails.IDShareholder, transType, IDTransaction, tradedatehaving sum(finalShares)> 0 and tradeDate between @startDate and @endDateAny Ideas ?????  |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2004-07-29 : 08:36:53
|
| If you want to give some sample data and a desired result, I'm sure we would find it much easier to point you in the right direction...Corey |
 |
|
|
ghumph
Starting Member
2 Posts |
Posted - 2004-07-29 : 09:01:12
|
| Here is some sample output it works in the way ou would expect but Im displaying it in a data dynamic active report and I want it to group the result set by the fundname and then as we are displaying the data we can display the transactions for each fund as one recordset for example the fund ADVANTAGE CONVERTIBLE SECURITES should be displayed together but instead the are treated as seperate.Hope you get meIDShareholder FundName stock Description IDTransaction tradedate ------------- -------------------------------------------------- ----------------------------------------------------- --------------- ------------- --------------------------- 87 ADVANTAGE CONVERTIBLE SECURITES 25.0 Redemption 13436 2004-07-25 00:00:00.00087 EPSILON USD 250.0 SUBSCRIPTION 13435 2004-07-26 00:00:00.00087 ADVANTAGE CONVERTIBLE SECURITES 50.0 OpeningBalance 0 1900-01-01 00:00:00.000 |
 |
|
|
|
|
|
|
|