I have the following query: SELECT DISTINCT "EVALA112"("S#") AS "^" FROM "S" ORDER BY "S#" ASC ;
[This is generated code, not hand-written. The table S is from CJ Date sample data.] This query appears to work correctly. The function is an aggregation, and requires the data to be sorted. This same query fails in Postgres with: "for SELECT DISTINCT, ORDER BY expressions must appear in select list". In effect the reason is that a query in this form requires two sort operations, and a single query can have only one. To get this to work correctly, I shall either drop the DISTINCT or turn the second part into a subselect. That I understand. The question is: how does Sqlite interpret this query? Why is it not an error? Is it because the query returns a single result, which does not require a sort? Regards David M Bennett FACS Andl - A New Database Language - andl.org