I have a few tables. A,B,C. All 1 to many relationships. A->B->C. I am trying to get the counts of how many B records there are for each A record, and how many C records for each A record. 1 record is returned for each A record.
I need something like Select A.idA, Sum(Case When B.idA = A.idA then 1 else 0 end) as [B sum], Sum(Case When C.idB= B.idB then 1 else 0 end) as [C sum].
Am I doing this correctly? I have a much bigger statement, but this is the basic concept I am trying to extend.
Thanks!!!
~J
I need something like Select A.idA, Sum(Case When B.idA = A.idA then 1 else 0 end) as [B sum], Sum(Case When C.idB= B.idB then 1 else 0 end) as [C sum].
Am I doing this correctly? I have a much bigger statement, but this is the basic concept I am trying to extend.
Thanks!!!
~J