---
title: Building storeys
summary: The storey an object belongs to — buildingStorey.attribute.Name and Elevation, the level index, filtering and grouping by storey, the storeys themselves, and the other spatial containers.
order: 160
terms: [building-storey]
see-also: [reference/bql/sub-features, reference/bql/calculated-values, reference/bql/group-by]
---

# Building storeys

`buildingStorey` follows the spatial containment of an object up to its [[term:building-storey|storey]] and reads features of that storey. It is the most used relation in BQL, so it has its own page; the general mechanism is on [[bql:sub-features]].

## buildingStorey.feature {#feature}

Any feature can follow the relation: `buildingStorey.attribute.Name`, `buildingStorey.attribute.Elevation`, `buildingStorey.qid`, `buildingStorey.calculated.property.level`, `buildingStorey.property.*`.

```bql {#storey-get}
GET qid, attribute.Name, buildingStorey.attribute.Name, buildingStorey.attribute.Elevation WHERE type = IFCDOOR
```

Several storey features at once, in the parenthesised form:

```bql {#storey-get-several}
GET qid, buildingStorey(attribute.Name, attribute.Elevation, calculated.property.level) WHERE type = IFCWINDOW
```

## Filtering by storey {#where}

```bql {#storey-where-name}
GET qid, attribute.Name WHERE type = IFCWALL AND buildingStorey.attribute.Name = "Level 1"
```

```bql {#storey-where-level}
GET qid, attribute.Name WHERE type = IFCSPACE AND buildingStorey.calculated.property.level >= 2
```

```bql {#storey-where-qid}
GET qid, type WHERE buildingStorey.qid IN $storeys
```

The level index (`calculated.property.level`) is independent of how the storeys are named, which makes it the robust key across models ([[bql:calculated-values#property]]).

## Grouping by storey {#group}

```bql {#storey-group}
GET buildingStorey.attribute.Name, type, COUNT(qid) WHERE type IN (IFCDOOR, IFCWINDOW) GROUP BY buildingStorey.attribute.Name, type
```

```bql {#storey-area}
GET buildingStorey.attribute.Name AS Storey, SUM(quantity.Qto_SpaceBaseQuantities.NetFloorArea) AS FloorArea WHERE type = IFCSPACE GROUP BY buildingStorey.attribute.Name
```

## The storeys themselves {#storeys}

Storeys are objects of class `IFCBUILDINGSTOREY`; `attribute.Elevation` orders them, `calculated.property.level` numbers them.

```bql {#storeys}
GET qid, attribute.Name, attribute.Elevation, calculated.property.level WHERE type = IFCBUILDINGSTOREY ORDER BY attribute.Elevation
```

To list what a storey contains, query downwards from it with `children` ([[bql:sub-features#children]]).

## Other containers {#containers}

The same pattern reaches the other levels of the spatial structure: `space` (the containing `IfcSpace`), `building`, `site`, `project`, and `containedIn` (the immediate spatial container, whatever its class).

```bql {#containers}
GET qid, attribute.Name, space.attribute.LongName, building.attribute.Name WHERE type = IFCFURNISHINGELEMENT
```

## Used in {#used-in}

- [[page:tutorials/bql/relations]] — doors per storey.
- [[page:tutorials/bql/grouping-and-aggregates]] — area per storey.
