Back to Questdb

DISTINCT keyword

documentation/query/sql/distinct.md

latest694 B
Original Source

SELECT DISTINCT is used to return only distinct (i.e different) values from a column as part of a SELECT statement.

Syntax

Examples

The following query will return a list of all unique ratings in the table.

questdb-sql
SELECT DISTINCT movieId
FROM ratings;

SELECT DISTINCT can be used in conjunction with more advanced queries and filters.

questdb-sql
SELECT DISTINCT movieId, count()
FROM ratings;
questdb-sql
SELECT DISTINCT movieId, count()
FROM ratings
WHERE score > 3;