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 expected. > 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. The GROUP BY NULL thing is not standard, which is why I qualified it with for sqlite. It varies from database to database. -- mysql, sqlite select max(a) from t group by null; select max(a) from t group by ''; -- postgres select max(a) from t group by +0; Oracle may or may not have an equivalent. Agreed. :)