![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
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) |
#2
| |||
| |||
|
|
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. |
|
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) |
#3
| |||
| |||
|
|
Bruno Wolff III<bruno (AT) wolff (DOT) to> 04/10/2004 10:58:49 AM |
|
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. |
|
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) |
#4
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |