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 as a 
developer I know better, and write aggregated sql with a group by.

select max(addr_id), emp_id from z_address group by null;

Does not return an error nor does it return data.

Ken


Joe Wilson <[EMAIL PROTECTED]> wrote: --- Darren Duncan  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 asserting that you have to agree with the rationale, but did you
> >see and read the discussion that Joe Wilson pointed out to you?
> >
> >=====================================================================
> >This issue is debated from time to time on the list:
> >
> >  http://www.mail-archive.com/sqlite-users@sqlite.org/msg17769.html
> 
> Sorry, I missed the url on my first reading.
> 
> Also, my first comment was based on the idea that SQL usually returns 
> exactly one row on a query that uses an aggregate but no group-by, 
> and where all result field values are scalar.

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).

But I agree with your point.





      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------




Joe Wilson <[EMAIL PROTECTED]> wrote: --- Darren Duncan  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 asserting that you have to agree with the rationale, but did you
> >see and read the discussion that Joe Wilson pointed out to you?
> >
> >=====================================================================
> >This issue is debated from time to time on the list:
> >
> >  http://www.mail-archive.com/sqlite-users@sqlite.org/msg17769.html
> 
> Sorry, I missed the url on my first reading.
> 
> Also, my first comment was based on the idea that SQL usually returns 
> exactly one row on a query that uses an aggregate but no group-by, 
> and where all result field values are scalar.

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).

But I agree with your point.





      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------


Reply via email to