From: | "Manfred Koroschetz" <mkoroschetz(at)tekvoice(dot)com> |
---|---|
To: | pgsql-novice-owner+M9926=mkoroschetz=rkmus(dot)com(at)postgresql(dot)org, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Help for MSSQL "Compute" equivalent in Postgres |
Date: | 2004-04-06 18:37:21 |
Message-ID: | WorldClient-F200404061437.AA37210135@tekvoice.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
The Compute by clause of MSSQL basically allows you to get a running
total at the bottom (end) of the report.
In a way it is similar then using ".. group by .." with aggregate
functions (sum) but in this case I am not trying to "... group by .."
does not make sense in the context of the query, just want to get a
summary (sum and count) of some columns at the end of the record.
Thanks in advance,
Manfred Koroschetz
mkoroschetz(at)tekvoice(dot)com
-----Original Message-----
From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: mkoroschetz(at)tekvoice(dot)com
Cc: pgsql-novice(at)postgresql(dot)org
Date: Tue, 06 Apr 2004 00:25:26 -0400
Subject: Re: [NOVICE] Help for MSSQL "Compute" equivalent in Postgres
> "Manfred Koroschetz" <mkoroschetz(at)tekvoice(dot)com> writes:
> > I am having trouble translating the following simple MSSQL query into
> > the equivalent Postgres form.
>
> > select A.ProdID, A.Description, A. Qty, A.Price
> > from SoldItems as A
> > where A.ListID = 15
> > order by A.ProdID
> > compute count(A.ProdID),sum(A.Price),sum(A.Qty)
>
> This "compute" construct does not exist in the SQL standard, so you'll
> have to forgive us for not immediately knowing what it does ... if
> you'd care to specify exactly what behavior you're trying to achieve,
> maybe we could help.
>
> regards, tom lane
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-04-06 19:12:57 | Re: 7.4 dramatically slower than 7.3? |
Previous Message | Stephan Szabo | 2004-04-06 16:21:45 | Re: 7.4 dramatically slower than 7.3? |