Strange output from list
Rob Williscroft
rtw at freenet.co.uk
Tue Nov 11 16:52:17 EST 2008
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.
Rob.
--
http://www.victim-prime.dsl.pipex.com/
More information about the Python-list
mailing list