Eliminating duplicate rows

Result tables from SELECT statements can contain duplicate rows. You can use the DISTINCT keyword to eliminate the duplicates. For example, the following command returns many duplicate rows:

SELECT city, state FROM employee

To list only unique combinations of city and state, use this command:

SELECT DISTINCT city, state FROM employee

NoteThe ROLLUP and CUBE operators do not support the DISTINCT keyword.

This chapter provides an overview of single-table SELECT statements. For more information about single-table SELECT statements, see Chapter 5, “Working with Database Objects,” in the Sybase IQ System Administration Guide, Chapter 3, “SQL Language Elements,” in the Sybase IQ Reference Manual, and “SELECT statement” in Chapter 6, “SQL Statements,” in the Sybase IQ Reference Manual.

Advanced uses of the SELECT statement are described in the next chapter.