Skip to content

Commit 803b173

Browse files
authored
Merge pull request #180608 from JimacoMS4/fix-gh-issue-79482-how-to-count-devices
Fix issue 79482 How to count devices
2 parents 43a5b18 + 47777b5 commit 803b173

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

articles/iot-hub/iot-hub-devguide-query-language.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ SELECT * FROM devices
8686
> [!NOTE]
8787
> [Azure IoT SDKs](iot-hub-devguide-sdks.md) support paging of large results.
8888
89+
Aggregations are supported. For example, the following query gets a count of the total number of devices in an IoT hub:
90+
91+
```sql
92+
SELECT COUNT() as totalNumberOfDevices FROM devices
93+
```
94+
8995
IoT Hub allows you to retrieve device twins filtering with arbitrary conditions. For instance, to receive device twins where the **location.region** tag is set to **US** use the following query:
9096

9197
```sql
@@ -117,7 +123,7 @@ SELECT * FROM devices
117123

118124
Refer to the [WHERE clause](iot-hub-devguide-query-language.md#where-clause) section for the full reference of the filtering capabilities.
119125

120-
Grouping and aggregations are also supported. For instance, to find the count of devices in each telemetry configuration status, use the following query:
126+
Grouping is also supported. For instance, to find the count of devices in each telemetry configuration status, use the following query:
121127

122128
```sql
123129
SELECT properties.reported.telemetryConfig.status AS status,

0 commit comments

Comments
 (0)