> bounces at mailinglists.sqlite.org] On Behalf Of Keith Medcalf

> Why are you using BOTH distinct and group by on the same column?  You only
> need one or the other.  If you are redundantly redundant I would hope that
> the optimizer makes redundant (as in gets rid of, for those that are not
> English) the redundancies ...

This is generated code. Since Andl does not allow any duplicate rows, every
SELECT gets a DISTINCT unless the query provably cannot generate duplicates.
You need both GROUP BY and DISTINCT in cases where there is an aggregate
function (and some others). Say:

SELECT DISTINCT SUM(X) AS Y FROM T GROUP BY Z;

There is no way to predict from the query how many rows this will generate.
Without DISTINCT it can generate duplicates.

My question was really about why Sqlite did not complain on what is actually
not a valid query. [Andl is still a work in progress.]

Regards
David M Bennett FACS

Andl - A New Database Language - andl.org





Reply via email to