Use WITH to define a common table expression.

The common table expression is used above the main SELECT clauses of the query. The reason for this is that the properties defined in the common table expression are referenced in subsequent SELECT statements for the overall query.


WITH commontablename AS
(SELECT property1 FROM object1)
SELECT property1 FROM commontablename