Azure Digital Twins query language reference: FROM clause
This document contains reference information on the FROM clause for the Azure Digital Twins query language.
The FROM clause is the second part of a query. It specifies the collection and any joins that the query will act on.
This clause is required for all queries.
SELECT ... FROM DIGITALTWINS
Use FROM DIGITALTWINS
(not case sensitive) to refer to the entire collection of digital twins in an instance.
You can optionally add a name to the collection of digital twins by adding the name to the end of the statement.
Syntax
Basic:
--SELECT ...
FROM DIGITALTWINS
To name the collection:
--SELECT ...
FROM DIGITALTWINS <collection-name>
Examples
Here's a basic query. The following query returns all digital twins in the instance.
SELECT *
FROM DIGITALTWINS
Here's a query with a named collection. The following query assigns a name T
to the collection, and still returns all digital twins in the instance.
SELECT *
FROM DIGITALTWINS T
SELECT ... FROM RELATIONSHIPS
Use FROM RELATIONSHIPS
(not case sensitive) to refer to the entire collection of relationships in an instance.
You can optionally add a name to the collection of relationships by adding the name to the end of the statement.
Note
This feature cannot be combined with JOIN
.
Syntax
Basic:
--SELECT ...
FROM RELATIONSHIPS
To name the collection:
--SELECT ...
FROM RELATIONSHIPS <collection-name>
Examples
Here's a query that returns all relationships in the instance.
SELECT *
FROM RELATIONSHIPS
Here's a query that returns all relationships coming from twins A
, B
, C
, or D
.
SELECT *
FROM RELATIONSHIPS
WHERE $sourceId IN ['A', 'B', 'C', 'D']
Using FROM and JOIN together
The FROM
clause can be combined with the JOIN
clause to express cross-entity traversals in the Azure Digital Twins graph.
For more information on the JOIN
clause and crafting graph traversal queries, see Azure Digital Twins query language reference: JOIN clause.
Limitations
The following limits apply to queries using FROM
.
For more information, see the following sections.
No subqueries
No subqueries are supported within the FROM
statement.
Example (negative)
The following query shows an example of what can't be done as per this limitation.
SELECT *
FROM (SELECT * FROM DIGITALTWINS T WHERE ...)
Choose FROM RELATIONSHIPS or JOIN
The FROM RELATIONSHIPS
feature cannot be combined with JOIN
. You'll have to select which of these options works best for the information you'd like to select.
Phản hồi
https://aka.ms/ContentUserFeedback.
Sắp ra mắt: Trong năm 2024, chúng tôi sẽ dần gỡ bỏ Sự cố với GitHub dưới dạng cơ chế phản hồi cho nội dung và thay thế bằng hệ thống phản hồi mới. Để biết thêm thông tin, hãy xem:Gửi và xem ý kiến phản hồi dành cho