Count Number Of Investors in fund

  • Hi,

    Please help me with this :

    I need to take count of investors invested and having balance in Funds:1,2,3,4,5,6,7,8 by date 12-03-2010

    I have following tables:

    aao_Fund_AJ ,Its Columns are : FId,FName

    aao_Balance_Aj ,its columns are :balance,holder,date

  • That will help to start getting relevant help:

    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • Reading the link Eugene provided will definitely help get better answers but here's something that I hope will help:

    Select

    Count(I.investorid) as investors,

    F.fundID

    From

    funds as F

    join investments as I

    on F.fundid = I.fundid

    Where

    F.fundid in (1,2,3,4,5,6,7,8) and

    I.investmentdate <= 12-03-2010

    Group By

    F.fundid

    /* this eliminates investors that don't have a balance and assumes

    that investments and withdrawals are in the investments table and

    will 0 each other out because a withdrawal is a negative */

    Having

    Sum(I.investmentamount) > 0

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply