Syntax:
ALL | DISTINCT | DISTINCTROW | TOP nn[%]
Example usage:
SELECT DISTINCT Name FROM Contact
The predicate alternatives have the following meanings:
ALL | This is assumed if no predicate is given. All rows meeting the other conditions in the SELECT statement are returned |
DISTINCT | Duplicate values in the returned table are omitted. |
DISTINCTROW | Duplicate values in the selected source table rows are omitted |
TOP | The top nn data rows are returned. The top nn% rows are returned in the percent sign is included |
Assuming the following data exists in table Toon in data source MyData:
FirstName | LastName |
Wilma | Flintstone |
Fred | Flintstone |
Then
SELECT DISTINCTROW LastName FROM Toon
results in
LastName |
Flintstone |
Flintstone |
because the two rows are distinct in the source table. However,
SELECT DISTINCT LastName FROM Toon
results in
LastName |
Flintstone |
because the two rows are identical in the returned table.