Strange output from list

Steve Holden steve at holdenweb.com
Wed Nov 12 03:25:09 CET 2008


Rob Williscroft wrote:
> Steve Holden wrote in news:mailman.3804.1226412496.3487.python-
> list at python.org in comp.lang.python:
> 
>>> Shouldn't it be GROUP BY master.id? I would have thought that SQL
>>> would be sad about a non-aggregate (master.id) that's in the SELECT
>>> list but not also in the GROUP BY list.
>>>
>> Well, I did say "untested". But in SQL Server, for example, any field
>> argument to COUNT() must be an aggregated column. So it may depend on
>> the SQL implementation. I should really have said
> 
> You must mean an "SQL Server" other than the Microsofts one, as:
> 
>     	select count( aid ) as "count"
>     	from table_1
>     	group by aid
> 
>     	count
>     	-----------
>     	8
>     	8
>     	8
>     	8
>     	8
>     	8
>     	8
>     	8
> 
>     	(8 row(s) affected)
> 
> and:
> 
>     	select count( aid ) as "count"
>     	from table_1
> 
>     	count
>     	-----------
>     	64
> 
>     	(1 row(s) affected)
> 
> Like it should.
> 
Hmm, strange. I must be thinking of some other SQL Server then. Or, more
likely, some other error situation.

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list