Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL: Implement TOP as an alternative to LIMIT (#57428) #57507

Merged
merged 1 commit into from
Jun 2, 2020

Conversation

matriv
Copy link
Contributor

@matriv matriv commented Jun 2, 2020

Add basic support for TOP X as a synonym to LIMIT X which is used
by MS-SQL server,
e.g.:

SELECT TOP 5 a, b, c FROM test

TOP in SQL server also supports the PERCENTAGE and WITH TIES
keywords which this implementation doesn't.

Don't allow usage of both TOP and LIMIT in the same query.

Refers to #41195

(cherry picked from commit 2f5ab81)

Add basic support for `TOP X` as a synonym to LIMIT X which is used
by [MS-SQL server](https://docs.microsoft.com/en-us/sql/t-sql/queries/top-transact-sql?view=sql-server-ver15),
e.g.:

```
SELECT TOP 5 a, b, c FROM test
```

TOP in SQL server also supports the `PERCENTAGE` and `WITH TIES`
keywords which this implementation doesn't.

Don't allow usage of both TOP and LIMIT in the same query.

Refers to elastic#41195

(cherry picked from commit 2f5ab81)
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-ql (:Query Languages/SQL)

@elasticmachine elasticmachine added the Team:QL (Deprecated) Meta label for query languages team label Jun 2, 2020
@matriv matriv merged commit b8a13de into elastic:7.x Jun 2, 2020
@matriv matriv deleted the backport-57428-7.x branch June 2, 2020 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/SQL SQL querying backport >enhancement Team:QL (Deprecated) Meta label for query languages team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants