PostgreSQL Macro Query

From: Bronagh Grimes <Bronagh(dot)Grimes(at)distinct(dot)ie>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: PostgreSQL Macro Query
Date: 2009-09-30 10:13:06
Message-ID: 94EA07ABBD904E42953296004CD2364002C5B59F10@mail-2008
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi there,

I have written some code to calculate basic summary stats and wish to then incorporate this code within a macro... I want to run the code many multiple times and define the variables (on which the summary statistics are calculated) outside of the basic code.

For example, see some very basic code below... I would use a macro so that I don't have to change 'STUDY_GROUP' in the code each time.

select "STUDY_GROUP" , count("STUDY_GROUP")
from "TABLE1" group by "STUDY_GROUP";

Many thanks in advance,

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2009-09-30 10:41:42 Re: PostgreSQL Macro Query
Previous Message rintaant 2009-09-30 10:11:52 Re: INSERT with RETURNING clause inside SQL function