• Good article. I have 1 question...

    Can someone please tell me what's wrong with this?

    
    
    select
    State,
    UserCount = count(distinct c.UserID),
    ComponentCount = count(u.LocationID)
    from
    #Locations l
    inner join #Users u on u.LocationID = l.LocationID
    inner join #Components c on c.UserID = u.UserID
    group by
    state

    For me it gives...

    
    
    State UserCount ComponentCount
    ----- ----------- --------------
    MD 2 6
    VA 2 4

    I'm using SQL 2000.

    Many Thanks.

    Ryan.

    Edited by - RyanRandall on 02/05/2002 11:10:31 AM

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.