RE: [sqlite] Aggregates in SELECT without GROUP BY

2008-01-15 Thread Ken
Joe Wilson <[EMAIL PROTECTED]> wrote: --- Ken wrote: > Doing this in oracle results in an error: > > SQL> select max(addr_id), emp_id from z_address; > select max(addr_id), emp_id from z_address > * > ERROR at line 1: > ORA-00937: not a single-group group function As

RE: [sqlite] Aggregates in SELECT without GROUP BY

2008-01-15 Thread Joe Wilson
--- Ken <[EMAIL PROTECTED]> wrote: > Doing this in oracle results in an error: > > SQL> select max(addr_id), emp_id from z_address; > select max(addr_id), emp_id from z_address > * > ERROR at line 1: > ORA-00937: not a single-group group function As expected. > I think an

RE: [sqlite] Aggregates in SELECT without GROUP BY

2008-01-15 Thread Ken
Doing this in oracle results in an error: SQL> select max(addr_id), emp_id from z_address; select max(addr_id), emp_id from z_address * ERROR at line 1: ORA-00937: not a single-group group function I think an error is more appropriate when there is no group by clause. But

RE: [sqlite] Aggregates in SELECT without GROUP BY

2008-01-15 Thread Darren Duncan
At 11:41 PM -0800 1/14/08, Joe Wilson wrote: In sqlite, assuming there's at least one row, an aggregate SELECT with no GROUP BY clause is conceptually the same as an equivalent SELECT with GROUP BY NULL - i.e., the group of all rows. (I say 'conceptually' because GROUP BY NULL is much slower).

RE: [sqlite] Aggregates in SELECT without GROUP BY

2008-01-14 Thread Joe Wilson
--- Darren Duncan <[EMAIL PROTECTED]> wrote: > At 10:17 PM -0500 1/14/08, Griggs, Donald wrote: > >Regarding: " A DBMS accepting such queries isn't just a little > >dangerous, its flat out wrong. I would ask what rationale there is for > >this query not failing. -- Darren Duncan" > > > >I'm not

RE: [sqlite] Aggregates in SELECT without GROUP BY

2008-01-14 Thread Darren Duncan
At 10:17 PM -0500 1/14/08, Griggs, Donald wrote: Hi Duncan, Regarding: " A DBMS accepting such queries isn't just a little dangerous, its flat out wrong. I would ask what rationale there is for this query not failing. -- Darren Duncan" I'm not asserting that you have to agree with the

RE: [sqlite] Aggregates in SELECT without GROUP BY

2008-01-14 Thread Griggs, Donald
Hi Duncan, Regarding: " A DBMS accepting such queries isn't just a little dangerous, its flat out wrong. I would ask what rationale there is for this query not failing. -- Darren Duncan" I'm not asserting that you have to agree with the rationale, but did you see and read the discussion that

Re: [sqlite] Aggregates in SELECT without GROUP BY

2008-01-14 Thread Darren Duncan
At 3:14 PM +0200 1/14/08, Lauri Nurmi wrote: SQLite seems to be accepting SELECT queries that use aggregate functions without a GROUP BY. This is a little dangerous, because queries that should not work at all are returning sensible-looking results. sqlite> SELECT MAX(a), b FROM T; 7|Mouse

Re: [sqlite] Aggregates in SELECT without GROUP BY

2008-01-14 Thread Joe Wilson
This issue is debated from time to time on the list: http://www.mail-archive.com/sqlite-users@sqlite.org/msg17769.html The only other database that I'm aware of that supports selecting non-aggregates that are not listed in GROUP BY is MySQL: -- valid in sqlite and mysql, invalid in postgres

RE: [sqlite] Aggregates in SELECT without GROUP BY

2008-01-14 Thread Samuel R. Neff
I've run into this issue myself and had more trouble than necessary tracking down problems related to it. Personally I would consider it a bug, but it's been discussed hear as accepted behavior. Sam --- We're Hiring! Seeking a passionate developer to