Skip to content

Commit ff06957

Browse files
committed
move distinct docs to query_clauses
1 parent b56b817 commit ff06957

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.. _distinct:
2+
3+
distinct
4+
=====
5+
6+
You can use ``distinct`` clauses with the following queries:
7+
8+
* :ref:`Select`
9+
10+
.. code-block:: python
11+
12+
>>> Band.select(Band.name).distinct().run_sync()
13+
[{'title': 'Pythonistas'}]
14+
15+
This is equivalent to ``SELECT DISTINCT name FROM band`` in SQL.

docs/src/piccolo/query_types/select.rst

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,6 @@ 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-
5846
Joins
5947
-----
6048

@@ -240,6 +228,11 @@ offset
240228

241229
See  :ref:`offset`.
242230

231+
distinct
232+
~~~~~
233+
234+
See  :ref:`distinct`.
235+
243236
order_by
244237
~~~~~~~~
245238

0 commit comments

Comments
 (0)