15.10 - WITH TIES - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

Product
Teradata Database
Release Number
15.10
Published
December 2015
Content Type
Programming Reference
Publication ID
B035-1144-151K
Language
English (United States)
Last Update
2018-06-05

All qualified rows having the same value for the ORDER BY fields are to be included in the results set.

This option only works if you also specify an ORDER BY clause; otherwise, the system ignores it.

If you do not specify the WITH TIES option, then the system returns only the first n or m PERCENT qualified rows.

For example, suppose you specify TOP 2 WITH TIES and ORDER BY OrderValue. If the top customer for this field has an OrderValue of 300,000 USD, but there are two additional customers with the same next highest OrderValue of 295,000 USD, then all 3 are returned in the result set.

If you did not specify WITH TIES, then only the first of the two customers encountered in the result list having an OrderValue of 295,000 USD would be returned.