On Tue, Jan 18, 2011 at 10:13:10PM +0100, Florian Weimer wrote:
> * Richard Hipp:
>
> > I don't think it makes sense in SQL (not just SQLite but SQL in
> > general) for an aggregate query to return columns that are not in
> > the GROUP BY clause.
>
> Isn't this just what PostgreSQL implements as DISTINCT ON? Then it
> *is* useful.
DISTINCT and DISTINCT ON effectively map to GROUP BY, no? DISTINCT ON
explicitly results in unpredictable results unless an ORDER BY clause is
also used.
Incidentally, if there is a UNIQUE constraint for the {grouping columns}
_and_ the non-aggregated/non-grouped columns, then such a query also
makes sense.
Nico
--
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users