On Wed, 30 Apr 2003, Daniele Orlandi wrote:
> I always had been doubious about the "must" in the error message
> "Attribute must be GROUPed or used in an aggregate function".
AFAIK it's a requirement of the SQL spec. (SQL92(draft) 7.9 SR 7, "each
<column reference> in each <value expression> that references a column
of T shall reference a grouping column or be specified within a <set
function specification>."
> For example, suppose that you join two tables and the field you group by
> appears to be the primary key of one of the tables. In this case if I
> put any of the fields in that table in the target list, it will always
> be well defined and would make certain queries much simpler.
Well, it'd mean you didn't have to put the extra columns in the group by
list to make them grouping columns.