On Fri, 14 Jan 2005 18:15:04 -0500, D. Richard Hipp <[EMAIL PROTECTED]> wrote:
> Tiago Dionizio wrote:
>
> > Hi,
> >
> > I am using a recent copy from CVS and tried this: (sorry for the quick
> > and dirty test)
> >
> > SQLite version 3.0.8
> > Enter ".help" for instructions
> > sqlite> create table t(a);
> > sqlite> insert into t values(1);
> > sqlite> select a from t group by a;
> > SQL error: GROUP BY may only be used on aggregate queries
> > sqlite>
> >
> > this behaviour was observed after check-in 2176
> >
> > I believe that the query used above is perfectly valid. Is this the
> > intended behaviour?
> >
>
>
> SQLite has never "allowed" queries to have a GROUP BY clause
> unless there is an aggregate function in the result set. I
> belive the documentation says as much. But prior to check-in 2176,
> the restriction was not fully enforced. Check-in 2176
> added tougher enforcement of the restriction.
I see. Thanks for the clarification, though i couldn't find a
reference to that in the online documentation.
Are there any plans to allow such queries without aggregate functions
in the future?
I believe that the query
"SELECT col FROM tbl GROUP BY col"
can be rewritten as
"SELECT DISTINCT col FROM tbl"
so i guess it is still safe.
Maybe this could be pointed in the documentation?
Regards,
Tiago