Oracle 9i Database, execute the following statement with an error "ORA-01791: not SELECTed expression": SELECT distinct t.name from Auth_employee t ORDER by t.auth_employee_i D ASC
Original: When the SELECT statement contains the DISTINCT keyword or an operator, the sort field must correspond to the field in the SELECT statement.
The online search is interpreted as follows: When you specify multiple columns in an order BY, the result is sorted first by the first column in the clause, then the second, and so on.
Column names that do not appear in Select are also available in the ORDER BY clause, as long as there is a row in the table. However, if the DISTINCT keyword appears in the SELECT clause, only the column names that appear, and if any operators are used in the SELECT clause, must be persisted in the ORDER BY clause to be identical to the expression in the SELECT clause, or an error occurs: "ORA-01791 : Not an SELECTed expression.
ORA-01791: not an SELECTed expression