Leider kann ich noch keinen Kommentar hinzufügen.
Was @Gordon Linoff geschrieben hat, ist genau richtig. Sie erhalten einen Fehler als DISTINCT funktioniert im Allgemeinen als Teil von SELECT -Klausel oder AGGREGATE Funktion. Es wird verwendet, um eindeutige Zeilen aus einer Ergebnismenge zurückzugeben, und es kann verwendet werden, um eindeutige Spaltenwerte innerhalb einer Aggregatfunktion zu erzwingen.
Beispiele:SELECT DISTINCT * ... COUNT(DISTINCT COLUMN) oder SUM(DISTINCT COLUMN).
Weitere Informationen zu DISTINCT in gängigen DB-Engines:
- PostgreSQL:https://www. postgresql.org/docs/9.0/static/sql-select.html#SQL-DISTINCT
- SQL-Server:https://www.techonthenet.com/sql_server/distinct.php
- Oracle:https://www.techonthenet.com/oracle/distinct.php
- MySQL:https://dev.mysql. com/doc/refman/5.7/en/distinct-optimization.html https://dev.mysql.com/doc/refman/5.7 /en/select.html