Skip to content

Conversation

@JPryce-Aklundh
Copy link
Collaborator

No description provided.


`ORDER BY` specifies how the output of a clause should be sorted.
It be used as a sub-clause following `RETURN` or `WITH`.
`ORDER BY` is a subclause which specifies the order in which the output of a xref:clauses/return.adoc[`RETURN`] or xref:clauses/with.adoc[`WITH`] clause.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`ORDER BY` is a subclause which specifies the order in which the output of a xref:clauses/return.adoc[`RETURN`] or xref:clauses/with.adoc[`WITH`] clause.
`ORDER BY` is a subclause which specifies the order of the output of a xref:clauses/return.adoc[`RETURN`] or xref:clauses/with.adoc[`WITH`] clause.

If it is an aggregating or `DISTINCT` projection, only the variables available in the projection are available.
If the projection does not alter the output cardinality (which aggregation and `DISTINCT` do), variables available from before the projecting clause are also available.
When the projection clause shadows already existing variables, only the new variables are available.
The variables available to `ORDER BY` depends on whether or not the preceding `RETURN` or `WITH` clause performs an aggregation to combine results or uses `DISTINCT` to remove duplicates.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The variables available to `ORDER BY` depends on whether or not the preceding `RETURN` or `WITH` clause performs an aggregation to combine results or uses `DISTINCT` to remove duplicates.
The variables available to `ORDER BY` depend on whether or not the preceding `RETURN` or `WITH` clause performs an aggregation to combine results or uses `DISTINCT` to remove duplicates.

@JPryce-Aklundh JPryce-Aklundh marked this pull request as ready for review May 21, 2025 07:59
@neo4j-docops-agent
Copy link
Collaborator

neo4j-docops-agent commented May 21, 2025

Thanks for the documentation updates.

The preview documentation has now been torn down - reopening this PR will republish it.

@JPryce-Aklundh JPryce-Aklundh merged commit c44f82e into neo4j:dev May 21, 2025
5 checks passed
@JPryce-Aklundh JPryce-Aklundh deleted the order_by_improvement branch May 21, 2025 09:50
JPryce-Aklundh added a commit that referenced this pull request May 21, 2025
JPryce-Aklundh added a commit to JPryce-Aklundh/docs-cypher that referenced this pull request May 21, 2025
JPryce-Aklundh added a commit that referenced this pull request May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick-this-to-5.x Cherry pick this PR changes to the 5.x branch cherry-pick-to-cypher-25

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants