Вы также можете использовать GROUP BY
:
SELECT <Column>
FROM <Table>
GROUP BY <Column>
например:.
>>> import sqlite3
>>> conn = sqlite3.connect(':memory:')
>>> c = conn.cursor()
>>> c.execute("CREATE TABLE test (col text);")
<sqlite3.Cursor object at 0x7f9ba3ec3c90>
>>> c.execute("INSERT INTO test VALUES ('distinct');")
<sqlite3.Cursor object at 0x7f9ba3ec3c90>
>>> c.execute("INSERT INTO test VALUES ('distinct');")
<sqlite3.Cursor object at 0x7f9ba3ec3c90>
>>> c.execute("SELECT col FROM test;").fetchall() # three results
[(u'distinct',), (u'distinct',), (u'distinct',)]
>>> c.execute("SELECT col FROM test GROUP BY col;").fetchall() # one result
[(u'distinct',)]