COUNT() with ORDER BY

From: "Andrus" <kobruleht2(at)hot(dot)ee>
To: pgsql-general(at)postgresql(dot)org
Subject: COUNT() with ORDER BY
Date: 2008-01-14 19:02:46
Message-ID: fmgbn2$ot6$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

create temp table test (col char);
select count(col) from test order by col;

causes

ERROR: column "test.col" must appear in the GROUP BY clause or be used in
an aggregate function
SQL state: 42803

How to fix this ?
This statement is generated by DbLinq driver and it is difficult to re-qrite
the driver.

Query looks quite resonable to me and should be accepted by PostgreSQL 8.3
Beta.

Andrus.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jessi Berkelhammer 2008-01-14 19:14:10 Re: oddly slow query
Previous Message Hannes Dorbath 2008-01-14 17:59:45 Re: Index trouble with 8.3b4