Helper aggregate function

From: "sergey kapustin" <kapustin(dot)sergey(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Helper aggregate function
Date: 2008-02-03 11:44:04
Message-ID: cf82f1380802030344x10138291ob685533ef4b5a4c8@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello!
Can anyone tell me how i do this properly?

create or replace function agg(varchar,varchar) returns void as $func$
select $1,count(*) from $2 group by $1 order by $1;
$func$
Language SQL;

Right now this wives me "ERROR: syntax error at or near "$2" at character
97
select $1,count(*) from $2 group by $1 order by $1;"

Thank you!

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Robins Tharakan 2008-02-03 18:58:00 Re: Helper aggregate function
Previous Message Jonah H. Harris 2008-02-03 01:27:23 Re: can a insert with a returning clause be subquery ?