Skip to content

Commit b56b817

Browse files
committed
add distinct docs
1 parent 7dfce9c commit b56b817

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/src/piccolo/query_types/select.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ By using ``as_alias``, the name of the row can be overriden in the response.
4343
4444
This is equivalent to ``SELECT name AS title FROM band`` in SQL.
4545

46+
Distinct
47+
--------
48+
49+
To get ``DISTINCT`` values of a column add `distinct()` to `select` statement.
50+
51+
.. code-block:: python
52+
53+
>>> Band.select(Band.name).distinct().run_sync()
54+
[{'title': 'Pythonistas'}]
55+
56+
This is equivalent to ``SELECT DISTINCT name FROM band`` in SQL.
57+
4658
Joins
4759
-----
4860

0 commit comments

Comments
 (0)