Include the DISTINCT keyword in your SELECT statement to direct Pervasive PSQL to remove duplicate values from the result. By using DISTINCT, you can retrieve all unique rows that match the SELECT statement's specifications.
- You can use DISTINCT in any statement that includes subqueries.
- The DISTINCT keyword is ignored if the selection list contains an aggregate; the aggregate guarantees that no duplicate rows result.
The following rules apply to using the DISTINCT keyword:
The following usage of DISTINCT is not allowed:
SELECT DISTINCT column1, DISTINCT column2
The following statement retrieves all the unique courses taught by Professor Beir (who has a Faculty ID of 111191115):
SELECT DISTINCT c.Name FROM Course c, class cl WHERE c.name = cl.name AND cl.faculty_id = '111191115'