• Your question is not clear enough.

    Firstly you want a query to include the count for FloorNameID but the heading that you want to end up with do not include anything to do with FloorNameID.

    Secondly in your INNER JOIN, it seems like table dbo.Address has no relationship with table dbo.PropertyFloor.

    The order of table relationship should be correct, and in this case it should be:

    FROM dbo.Address AS A WITH (nolock)

    INNER JOIN dbo.Property AS P ON A.AddressID = P.PrimaryAddressID

    INNER JOIN dbo.PropertyFloor PF ON P.PropertyID = PF.PropertyID

    INNER JOIN dbo.FloorName FN ON PF.FloorNameID = FN.FloorNameID

    The way I understand your question as written, I would do it this way:

    SELECT

    P.PropertyID,

    P.RentableSqFtTotal,

    SUM(PF.GrossFloorSqFt) GrossFloorSqFt,

    P.RentableSqFtTotal - SUM(PF.GrossFloorSqFt) Difference

    ..........

    Group by

    P.PropertyID,

    P.RentableSqFtTotal

    Please try to build the question again so we can understand your question. Help us to understand in order to help you