15.10 - WITH TIES - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

prodname
Teradata Database
vrm_release
15.10
created_date
December 2015
category
Programming Reference
featnum
B035-1144-151K

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.