Skip to content Skip to sidebar Skip to footer

Need Help Creating An Outer Join To Count Spaces

I have a table vw_Lab_Space which lists out all of my labs, and has a Lab_Space_Id column which is the key, and a Campus_Name column, plus a bunch of other columns. Then in the vw_

Solution 1:

I suspect you are overthinking it

Select A.Campus_Name 
      ,Labs    =sum(1)
      ,SubNets =count(B.Lab_Space_ID)
 from YourTable1 A
 LeftJoin YourTable2 B on A.Lab_Space_Id = B.Lab_Space_Id
 GroupBy A.Campus_Name

Returns

Campus_Name Labs    SubNets
Blue        2       0
Green       1       1
Red         2       1

Post a Comment for "Need Help Creating An Outer Join To Count Spaces"