Re: Help for MSSQL "Compute" equivalent in Postgres

Поиск
Список
Период
Сортировка
От Manfred Koroschetz
Тема Re: Help for MSSQL "Compute" equivalent in Postgres
Дата
Msg-id WorldClient-F200404061437.AA37210135@tekvoice.com
обсуждение исходный текст
Ответ на Re: Help for MSSQL "Compute" equivalent in Postgres  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Help for MSSQL "Compute" equivalent in Postgres  (Bruno Wolff III <bruno@wolff.to>)
Список 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@tekvoice.com

-----Original Message-----
From: Tom Lane <tgl@sss.pgh.pa.us>
To: mkoroschetz@tekvoice.com
Cc: pgsql-novice@postgresql.org
Date: Tue, 06 Apr 2004 00:25:26 -0400
Subject: Re: [NOVICE] Help for MSSQL "Compute" equivalent in Postgres

> "Manfred Koroschetz" <mkoroschetz@tekvoice.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


В списке pgsql-novice по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Usage: pg_dump's text format
Следующее
От: "R V Sreedharan"
Дата:
Сообщение: adopendynamic