J
Jeff Uchtman
I have a table that upon verify is inserting a unique Cir_ID in to one of
four columns, PetACirc, PetBCirc, PetCCirc, PetDCirc. I am attempting to
count the total number of columns each Cir_ID has filled and left join the
name for association. I have part of it but can't get over the hump to get
the count from the other 3 columns. Her is what I have:
Select p.Cir_ID, p.First_Name, p.Last_Name,
Count(c.PetACirc)AS [ACount],
Count(c.PetBCirc)AS [BCount],
Count(c.PetCCirc)AS [CCount],
Count(c.PetDCirc)AS [DCount]
From CirID
AS p Left JOIN Verified as c on p.Cir_ID = c.PetACirc
Group by p.Cir_ID, p.First_Name, p.Last_Name
Order by p.Cir_ID
As you can see it will give me the count on the PetACirc column in the line:
AS p Left JOIN Verified as c on p.Cir_ID = c.PetACirc
but I would also like PetBCirc, PetCCirc, and PetDCirc counts. Any help on
inner and or left join with a distinct value?
Thanks
Jeff
four columns, PetACirc, PetBCirc, PetCCirc, PetDCirc. I am attempting to
count the total number of columns each Cir_ID has filled and left join the
name for association. I have part of it but can't get over the hump to get
the count from the other 3 columns. Her is what I have:
Select p.Cir_ID, p.First_Name, p.Last_Name,
Count(c.PetACirc)AS [ACount],
Count(c.PetBCirc)AS [BCount],
Count(c.PetCCirc)AS [CCount],
Count(c.PetDCirc)AS [DCount]
From CirID
AS p Left JOIN Verified as c on p.Cir_ID = c.PetACirc
Group by p.Cir_ID, p.First_Name, p.Last_Name
Order by p.Cir_ID
As you can see it will give me the count on the PetACirc column in the line:
AS p Left JOIN Verified as c on p.Cir_ID = c.PetACirc
but I would also like PetBCirc, PetCCirc, and PetDCirc counts. Any help on
inner and or left join with a distinct value?
Thanks
Jeff